diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 15:44:20 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:36:00 +0200 |
commit | d72499d0a166dba8371cbdd627932aa82b3f58ef (patch) | |
tree | 90e9fb5a40e0d63d939f12de0efeff71a009ccd0 /tests | |
parent | 71020af95b4173a0878adb99b0a27ca5adc2ceb6 (diff) |
Use do_run_from_file() for test_sscanf_3
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/test_sscanf_3.in | 17 | ||||
-rw-r--r-- | tests/core/test_sscanf_3.out | 4 | ||||
-rw-r--r-- | tests/test_core.py | 21 |
3 files changed, 24 insertions, 18 deletions
diff --git a/tests/core/test_sscanf_3.in b/tests/core/test_sscanf_3.in new file mode 100644 index 00000000..fb8949e7 --- /dev/null +++ b/tests/core/test_sscanf_3.in @@ -0,0 +1,17 @@ + + #include <stdint.h> + #include <stdio.h> + + int main(){ + + int64_t s, m, l; + printf("%d\n", sscanf("123 1073741823 1125899906842620", "%lld %lld %lld", &s, &m, &l)); + printf("%lld,%lld,%lld\n", s, m, l); + + int64_t negS, negM, negL; + printf("%d\n", sscanf("-123 -1073741823 -1125899906842620", "%lld %lld %lld", &negS, &negM, &negL)); + printf("%lld,%lld,%lld\n", negS, negM, negL); + + return 0; + } +
\ No newline at end of file diff --git a/tests/core/test_sscanf_3.out b/tests/core/test_sscanf_3.out new file mode 100644 index 00000000..fe1d5b41 --- /dev/null +++ b/tests/core/test_sscanf_3.out @@ -0,0 +1,4 @@ +3 +123,1073741823,1125899906842620 +3 +-123,-1073741823,-1125899906842620 diff --git a/tests/test_core.py b/tests/test_core.py index c2faf81d..d89cb179 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -3720,26 +3720,11 @@ Pass: 0.000012 0.000012''') def test_sscanf_3(self): # i64 if not Settings.USE_TYPED_ARRAYS == 2: return self.skip('64-bit sscanf only supported in ta2') - src = r''' - #include <stdint.h> - #include <stdio.h> - - int main(){ - - int64_t s, m, l; - printf("%d\n", sscanf("123 1073741823 1125899906842620", "%lld %lld %lld", &s, &m, &l)); - printf("%lld,%lld,%lld\n", s, m, l); - int64_t negS, negM, negL; - printf("%d\n", sscanf("-123 -1073741823 -1125899906842620", "%lld %lld %lld", &negS, &negM, &negL)); - printf("%lld,%lld,%lld\n", negS, negM, negL); - - return 0; - } - ''' + test_path = path_from_root('tests', 'core', 'test_sscanf_3') + src, output = (test_path + s for s in ('.in', '.out')) - self.do_run(src, '3\n123,1073741823,1125899906842620\n' + - '3\n-123,-1073741823,-1125899906842620\n') + self.do_run_from_file(src, output) def test_sscanf_4(self): src = r''' |