#include #include struct test_cases { char *s2; char *exp; }; char s1[] = "abcdefg"; struct test_cases tc[] = { { "abc", s1 }, { "abfg", NULL }, { "abcdefg", s1 }, { "abcdefgh", NULL }, { "xczy", NULL }, { "def", s1+3 }, { "efg", s1+4 }, { "b", s1+1 }, { "g", s1+6 }, { "a", s1 }, { "x", NULL }, { "", s1 }, { NULL, NULL } }; int main (void) { unsigned char test_num = 0; struct test_cases *curr = tc; PORTB = 0xff; DDRB = 0xff; PORTD = 0xff; DDRD = 0xff; while (1) { if (curr->s2 == NULL) { break; } if (strstr (s1, curr->s2) == curr->exp) PORTB = test_num; /* pass */ else PORTD = test_num; /* fail */ test_num++; curr++; } return 0; }