Generate test cases by basic path testing int is_valid_ip(const char *ip) { int section = 0; int valid = 0; while(*ip){ if(*ip=='.'){ if(section<=255) section = 0; else { valid =0; break;} } else if (*ip>='0' && *ip<='9') section = section * 10 + *ip - '0'; else { valid = 0; break;}
Generate test cases by basic path testing int is_valid_ip(const char *ip) { int section = 0; int valid = 0; while(*ip){ if(*ip=='.'){ if(section<=255) section = 0; else { valid =0; break;} } else if (*ip>='0' && *ip<='9') section = section * 10 + *ip - '0'; else { valid = 0; break;}
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
Generate test cases by basic path testing
int is_valid_ip(const char *ip)
{
int section = 0;
int valid = 0;
while(*ip){
if(*ip=='.'){
if(section<=255)
section = 0;
else { valid =0; break;}
}
else if (*ip>='0' && *ip<='9')
section = section * 10 + *ip - '0';
else { valid = 0; break;}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps