17 int compare_string(char *CompValue, char *ValuePtr)
20 unsigned char *p0 = (unsigned char *)CompValue;
21 unsigned char *p1 = (unsigned char *)ValuePtr;
23 /* Compare the string pointed to by CompValue
24 against string pointed to by ValuePtr */
27 if (sprintf (Msg, " Ut_CompareString:: <%-24s> To <%-24s>;\n",
32 for (i = 0; i == 0 && *p0 != NULL && *p1 != NULL; p0++, p1++)
49 if (ClassBug && !SetBug)
50 if (sprintf (Msg, " Ut_Compare:: <%-16s> To <%-16s>; i = %d\n",
51 CompValue, ValuePtr, i))
60 #define test(a,b,shouldbe) { int res = compare_string(a, b); printf("Compare %s, %s -> %d (should be %d)\n", a, b, res, shouldbe); assert(res == shouldbe); }
63 test("Rothe", "Rother", -1);
64 test("hallo", "hallo", 0);
65 test("hallo", "welt", -1);
66 test("welt", "hallo", 1);
68 printf("Simpler: %d\n", simpler());