diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 13:54:15 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:35:57 +0200 |
commit | 9d525831447f3897a69cbe51fb2eec54f86e43c6 (patch) | |
tree | a7614df09d10bf9305bf6a48901098da25685638 | |
parent | e9a04792bfc7b808ea94b1b7694fc1dd38258f67 (diff) |
Use do_run_from_file() for test_strtol_bin
-rw-r--r-- | tests/core/test_strtol_bin.in | 17 | ||||
-rw-r--r-- | tests/core/test_strtol_bin.out | 1 | ||||
-rw-r--r-- | tests/test_core.py | 20 |
3 files changed, 21 insertions, 17 deletions
diff --git a/tests/core/test_strtol_bin.in b/tests/core/test_strtol_bin.in new file mode 100644 index 00000000..972853ba --- /dev/null +++ b/tests/core/test_strtol_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 l4 = strtol(STRING, &end_char, 2); + long l5 = strtol(end_char, &end_char, 2); + long l6 = strtol(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_strtol_bin.out b/tests/core/test_strtol_bin.out new file mode 100644 index 00000000..9d07aa0d --- /dev/null +++ b/tests/core/test_strtol_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 6791e568..c3663f4c 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -2404,24 +2404,10 @@ The current type of b is: 9 def test_strtol_bin(self): # 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 l4 = strtol(STRING, &end_char, 2); - long l5 = strtol(end_char, &end_char, 2); - long l6 = strtol(end_char, NULL, 2); + test_path = path_from_root('tests', 'core', 'test_strtol_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_strtol_oct(self): # tests strtoll for decimal strings (0x...) |