Usermode/utests - Fix DNS utest, update libc utests to new format (no more EXP files)
[tpg/acess2.git] / Usermode / Libraries / libc.so_src / TEST_strtoi.c
index 62f2e69..cf2d269 100644 (file)
        char *end;\
        errno = 0;\
        t ret = strto##class(in, &end, base); \
-       if( ret != exp ) \
+       if( ret != exp ) \
                fprintf(stderr, "FAIL strto"#class"('%s') != "#exp" (act "fmt")\n", in, ret);\
-       if( end != in+ofs ) \
+               exit(1); \
+       } \
+       if( end != in+ofs ) { \
                fprintf(stderr, "FAIL strto"#class"('%s') returned wrong end: %p (+%zi) instead of %p (+%zi)\n",\
                        in,end,end-in,in+ofs,(size_t)ofs);\
-       if( exp_errno != errno ) \
+               exit(1); \
+       } \
+       if( exp_errno != errno ) { \
                fprintf(stderr, "FAIL strto"#class"('%s') returned wrong errno, exp '%s', got '%s'\n",\
                        in, strerror(exp_errno), strerror(errno));\
+               exit(1); \
+       } \
 }while(0)
 
 #define PRIMEBUF(fmt, val)     buf_len = snprintf(buf, sizeof(buf), fmt, val)
@@ -41,6 +47,8 @@ int main(int argc, char *argv[])
        TST(unsigned long long, ull, 0, "01234567", 01234567, "%llo", 8, 0);
        TST(unsigned long long, ull, 0, "1234567", 1234567, "%lld", 7, 0);
        TST(long long, ll, 0, "-1", -1, "%lld", 2, 0);  // -1
+       TST(long long, ll, 0, "100113", 100113, "%lld", strlen(in), 0);
+       TST(long long, ll, 0, "0x101", 0x101, "0x%llx", strlen(in), 0);
        
        // Invalid strings
        TST(unsigned long long, ull, 0, "0x",  0, "%llx", 1, 0);        // Single 0

UCC git Repository :: git.ucc.asn.au