From f742cc19931cb3debb2dfa81b80245765eeb01dd Mon Sep 17 00:00:00 2001 From: Vasilis Kalintiris Date: Sat, 7 Dec 2013 13:51:19 +0200 Subject: Use do_run_from_file() for test_strtol_hex --- tests/core/test_strtol_hex.in | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/core/test_strtol_hex.in (limited to 'tests/core/test_strtol_hex.in') diff --git a/tests/core/test_strtol_hex.in b/tests/core/test_strtol_hex.in new file mode 100644 index 00000000..f11d786a --- /dev/null +++ b/tests/core/test_strtol_hex.in @@ -0,0 +1,22 @@ + + #include + #include + + int main() { + const char *STRING = "0x4 -0x3A +0xDEAD"; + char *end_char; + + // undefined base + long l1 = strtol(STRING, &end_char, 0); + long l2 = strtol(end_char, &end_char, 0); + long l3 = strtol(end_char, NULL, 0); + + // defined base + long l4 = strtol(STRING, &end_char, 16); + long l5 = strtol(end_char, &end_char, 16); + long l6 = strtol(end_char, NULL, 16); + + printf("%d%d%d%d%d%d\n", l1==0x4, l2==-0x3a, l3==0xdead, l4==0x4, l5==-0x3a, l6==0xdead); + return 0; + } + \ No newline at end of file -- cgit v1.2.3-18-g5258