aboutsummaryrefslogtreecommitdiff
path: root/tests/test_core.py
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 13:51:19 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:57 +0200
commitf742cc19931cb3debb2dfa81b80245765eeb01dd (patch)
treef766be1a8bdcb318166a981f2d1f1e78607806ee /tests/test_core.py
parent7237a73de96b8d085ff7e88b46d479cc238e2f0d (diff)
Use do_run_from_file() for test_strtol_hex
Diffstat (limited to 'tests/test_core.py')
-rw-r--r--tests/test_core.py25
1 files changed, 3 insertions, 22 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index 41603f5b..610896be 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -2390,29 +2390,10 @@ The current type of b is: 9
def test_strtol_hex(self):
# tests strtoll for hex strings (0x...)
- src = r'''
- #include <stdio.h>
- #include <stdlib.h>
-
- 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);
+ test_path = path_from_root('tests', 'core', 'test_strtol_hex')
+ src, output = (test_path + s for s in ('.in', '.out'))
- printf("%d%d%d%d%d%d\n", l1==0x4, l2==-0x3a, l3==0xdead, l4==0x4, l5==-0x3a, l6==0xdead);
- return 0;
- }
- '''
- self.do_run(src, '111111')
+ self.do_run_from_file(src, output)
def test_strtol_dec(self):
# tests strtoll for decimal strings (0x...)