If the string does not convert back, print the buggy result.
authorAndrew Bartlett <abartlet@samba.org>
Sun, 6 Apr 2003 12:01:44 +0000 (12:01 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 6 Apr 2003 12:01:44 +0000 (12:01 +0000)
(This used to be commit 98f76325542c0ab2e0bbcf082a15c6f8db27e37c)

source3/torture/t_push_ucs2.c

index 0ab17983a0bd433fd5621f4a4246982e79be79a2..ca04394acce90b69ecfb2f9082677329a226f6b6 100644 (file)
@@ -16,22 +16,29 @@ static int check_push_ucs2(const char *orig)
        push_ucs2_allocate(&dest, orig);
        pull_ucs2_allocate(&orig2, dest);
        ret = strcmp(orig, orig2);
+       if (ret) {
+               fprintf(stderr, "orig: %s\n", orig);
+               fprintf(stderr, "orig (UNIX -> UCS2 -> UNIX): %s\n", orig2);
+       }
+
        SAFE_FREE(dest);
        SAFE_FREE(orig2);
+
+       return ret;
 }
 
 int main(int argc, char *argv[])
 {
-       int i, ret;
+       int i, ret = 0;
        
        if (argc != 2) {
                fprintf(stderr, "usage: %s STRING1\n"
-                       "Converts a string, prints the results of memcmp\n",
+                       "Converts a string, prints the results of strcmp\n",
                        argv[0]);
                return 2;
        }
 
-       for (i = 0; i < 10000; i++)
+       for (i = 0; ((i < 10000) && (!ret)); i++)
                ret = check_push_ucs2(argv[1]);
 
        printf("%d\n", ret);