aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 13:47:21 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:57 +0200
commitadd713ad04242d0f68754dffd6e06253f3d7d114 (patch)
tree0367015e519c3bc92819eba2335137d8cff2fd2c
parenta929948ea5c9e88f9bbdbedaa91ccd6263419398 (diff)
Use do_run_from_file() for test_strtoll_bin
-rw-r--r--tests/core/test_strtoll_bin.in17
-rw-r--r--tests/core/test_strtoll_bin.out1
-rw-r--r--tests/test_core.py20
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')