diff options
-rw-r--r-- | tests/core/test_strtoll_bin.in | 17 | ||||
-rw-r--r-- | tests/core/test_strtoll_bin.out | 1 | ||||
-rw-r--r-- | tests/test_core.py | 20 |
3 files changed, 21 insertions, 17 deletions
diff --git a/tests/core/test_strtoll_bin.in b/tests/core/test_strtoll_bin.in new file mode 100644 index 00000000..ed3c4acf --- /dev/null +++ b/tests/core/test_strtoll_bin.in @@ -0,0 +1,17 @@ + + #include <stdio.h> + #include <stdlib.h> + + int main() { + const char *STRING = "1 -101 +1011"; + char *end_char; + + // defined base + long long int l4 = strtoll(STRING, &end_char, 2); + long long int l5 = strtoll(end_char, &end_char, 2); + long long int l6 = strtoll(end_char, NULL, 2); + + printf("%d%d%d\n", l4==1, l5==-5, l6==11); + return 0; + } +
\ No newline at end of file diff --git a/tests/core/test_strtoll_bin.out b/tests/core/test_strtoll_bin.out new file mode 100644 index 00000000..9d07aa0d --- /dev/null +++ b/tests/core/test_strtoll_bin.out @@ -0,0 +1 @@ +111
\ No newline at end of file diff --git a/tests/test_core.py b/tests/test_core.py index 097c4907..201f9ff4 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -2374,24 +2374,10 @@ The current type of b is: 9 if self.emcc_args is None: return self.skip('requires emcc') # tests strtoll for binary strings (0x...) - src = r''' - #include <stdio.h> - #include <stdlib.h> - - int main() { - const char *STRING = "1 -101 +1011"; - char *end_char; - - // defined base - long long int l4 = strtoll(STRING, &end_char, 2); - long long int l5 = strtoll(end_char, &end_char, 2); - long long int l6 = strtoll(end_char, NULL, 2); + test_path = path_from_root('tests', 'core', 'test_strtoll_bin') + src, output = (test_path + s for s in ('.in', '.out')) - printf("%d%d%d\n", l4==1, l5==-5, l6==11); - return 0; - } - ''' - self.do_run(src, '111') + self.do_run_from_file(src, output) def test_strtoll_oct(self): if self.emcc_args is None: return self.skip('requires emcc') |