diff options
-rw-r--r-- | tests/core/test_strtoll_oct.in | 22 | ||||
-rw-r--r-- | tests/core/test_strtoll_oct.out | 1 | ||||
-rw-r--r-- | tests/test_core.py | 25 |
3 files changed, 26 insertions, 22 deletions
diff --git a/tests/core/test_strtoll_oct.in b/tests/core/test_strtoll_oct.in new file mode 100644 index 00000000..260c7245 --- /dev/null +++ b/tests/core/test_strtoll_oct.in @@ -0,0 +1,22 @@ + + #include <stdio.h> + #include <stdlib.h> + + int main() { + const char *STRING = "0 -035 +04711"; + char *end_char; + + // undefined base + long long int l1 = strtoll(STRING, &end_char, 0); + long long int l2 = strtoll(end_char, &end_char, 0); + long long int l3 = strtoll(end_char, NULL, 0); + + // defined base + long long int l4 = strtoll(STRING, &end_char, 8); + long long int l5 = strtoll(end_char, &end_char, 8); + long long int l6 = strtoll(end_char, NULL, 8); + + printf("%d%d%d%d%d%d\n", l1==0, l2==-29, l3==2505, l4==0, l5==-29, l6==2505); + return 0; + } +
\ No newline at end of file diff --git a/tests/core/test_strtoll_oct.out b/tests/core/test_strtoll_oct.out new file mode 100644 index 00000000..b23c1c51 --- /dev/null +++ b/tests/core/test_strtoll_oct.out @@ -0,0 +1 @@ +111111
\ No newline at end of file diff --git a/tests/test_core.py b/tests/test_core.py index 201f9ff4..41603f5b 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -2383,30 +2383,11 @@ The current type of b is: 9 if self.emcc_args is None: return self.skip('requires emcc') # tests strtoll for decimal strings (0x...) - src = r''' - #include <stdio.h> - #include <stdlib.h> - - int main() { - const char *STRING = "0 -035 +04711"; - char *end_char; - - // undefined base - long long int l1 = strtoll(STRING, &end_char, 0); - long long int l2 = strtoll(end_char, &end_char, 0); - long long int l3 = strtoll(end_char, NULL, 0); + test_path = path_from_root('tests', 'core', 'test_strtoll_oct') + src, output = (test_path + s for s in ('.in', '.out')) - // defined base - long long int l4 = strtoll(STRING, &end_char, 8); - long long int l5 = strtoll(end_char, &end_char, 8); - long long int l6 = strtoll(end_char, NULL, 8); + self.do_run_from_file(src, output) - printf("%d%d%d%d%d%d\n", l1==0, l2==-29, l3==2505, l4==0, l5==-29, l6==2505); - return 0; - } - ''' - self.do_run(src, '111111') - def test_strtol_hex(self): # tests strtoll for hex strings (0x...) src = r''' |