diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 16:47:35 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:36:01 +0200 |
commit | 70884fb056b4d862fc0038cdcb4a742e5d13aa94 (patch) | |
tree | 6e0330e6a0687b323da7f4efbb5a700f236240f9 /tests/test_core.py | |
parent | cca2d0cb66ee181b0be50f341dcd48f7d34b45bd (diff) |
Use do_run_from_file() for test_strcasecmp
Diffstat (limited to 'tests/test_core.py')
-rw-r--r-- | tests/test_core.py | 84 |
1 files changed, 3 insertions, 81 deletions
diff --git a/tests/test_core.py b/tests/test_core.py index 6bdd52bc..01bacca7 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -4220,88 +4220,10 @@ PORT: 3979 self.do_run(src, expected) def test_strcasecmp(self): - src = r''' - #include <stdio.h> - #include <strings.h> - int sign(int x) { - if (x < 0) return -1; - if (x > 0) return 1; - return 0; - } - int main() { - printf("*\n"); - - printf("%d\n", sign(strcasecmp("hello", "hello"))); - printf("%d\n", sign(strcasecmp("hello1", "hello"))); - printf("%d\n", sign(strcasecmp("hello", "hello1"))); - printf("%d\n", sign(strcasecmp("hello1", "hello1"))); - printf("%d\n", sign(strcasecmp("iello", "hello"))); - printf("%d\n", sign(strcasecmp("hello", "iello"))); - printf("%d\n", sign(strcasecmp("A", "hello"))); - printf("%d\n", sign(strcasecmp("Z", "hello"))); - printf("%d\n", sign(strcasecmp("a", "hello"))); - printf("%d\n", sign(strcasecmp("z", "hello"))); - printf("%d\n", sign(strcasecmp("hello", "a"))); - printf("%d\n", sign(strcasecmp("hello", "z"))); - - printf("%d\n", sign(strcasecmp("Hello", "hello"))); - printf("%d\n", sign(strcasecmp("Hello1", "hello"))); - printf("%d\n", sign(strcasecmp("Hello", "hello1"))); - printf("%d\n", sign(strcasecmp("Hello1", "hello1"))); - printf("%d\n", sign(strcasecmp("Iello", "hello"))); - printf("%d\n", sign(strcasecmp("Hello", "iello"))); - printf("%d\n", sign(strcasecmp("A", "hello"))); - printf("%d\n", sign(strcasecmp("Z", "hello"))); - printf("%d\n", sign(strcasecmp("a", "hello"))); - printf("%d\n", sign(strcasecmp("z", "hello"))); - printf("%d\n", sign(strcasecmp("Hello", "a"))); - printf("%d\n", sign(strcasecmp("Hello", "z"))); - - printf("%d\n", sign(strcasecmp("hello", "Hello"))); - printf("%d\n", sign(strcasecmp("hello1", "Hello"))); - printf("%d\n", sign(strcasecmp("hello", "Hello1"))); - printf("%d\n", sign(strcasecmp("hello1", "Hello1"))); - printf("%d\n", sign(strcasecmp("iello", "Hello"))); - printf("%d\n", sign(strcasecmp("hello", "Iello"))); - printf("%d\n", sign(strcasecmp("A", "Hello"))); - printf("%d\n", sign(strcasecmp("Z", "Hello"))); - printf("%d\n", sign(strcasecmp("a", "Hello"))); - printf("%d\n", sign(strcasecmp("z", "Hello"))); - printf("%d\n", sign(strcasecmp("hello", "a"))); - printf("%d\n", sign(strcasecmp("hello", "z"))); - - printf("%d\n", sign(strcasecmp("Hello", "Hello"))); - printf("%d\n", sign(strcasecmp("Hello1", "Hello"))); - printf("%d\n", sign(strcasecmp("Hello", "Hello1"))); - printf("%d\n", sign(strcasecmp("Hello1", "Hello1"))); - printf("%d\n", sign(strcasecmp("Iello", "Hello"))); - printf("%d\n", sign(strcasecmp("Hello", "Iello"))); - printf("%d\n", sign(strcasecmp("A", "Hello"))); - printf("%d\n", sign(strcasecmp("Z", "Hello"))); - printf("%d\n", sign(strcasecmp("a", "Hello"))); - printf("%d\n", sign(strcasecmp("z", "Hello"))); - printf("%d\n", sign(strcasecmp("Hello", "a"))); - printf("%d\n", sign(strcasecmp("Hello", "z"))); - - printf("%d\n", sign(strncasecmp("hello", "hello", 3))); - printf("%d\n", sign(strncasecmp("hello1", "hello", 3))); - printf("%d\n", sign(strncasecmp("hello", "hello1", 3))); - printf("%d\n", sign(strncasecmp("hello1", "hello1", 3))); - printf("%d\n", sign(strncasecmp("iello", "hello", 3))); - printf("%d\n", sign(strncasecmp("hello", "iello", 3))); - printf("%d\n", sign(strncasecmp("A", "hello", 3))); - printf("%d\n", sign(strncasecmp("Z", "hello", 3))); - printf("%d\n", sign(strncasecmp("a", "hello", 3))); - printf("%d\n", sign(strncasecmp("z", "hello", 3))); - printf("%d\n", sign(strncasecmp("hello", "a", 3))); - printf("%d\n", sign(strncasecmp("hello", "z", 3))); - - printf("*\n"); + test_path = path_from_root('tests', 'core', 'test_strcasecmp') + src, output = (test_path + s for s in ('.in', '.out')) - return 0; - } - ''' - self.do_run(src, '''*\n0\n1\n-1\n0\n1\n-1\n-1\n1\n-1\n1\n1\n-1\n0\n1\n-1\n0\n1\n-1\n-1\n1\n-1\n1\n1\n-1\n0\n1\n-1\n0\n1\n-1\n-1\n1\n-1\n1\n1\n-1\n0\n1\n-1\n0\n1\n-1\n-1\n1\n-1\n1\n1\n-1\n0\n0\n0\n0\n1\n-1\n-1\n1\n-1\n1\n1\n-1\n*\n''') + self.do_run_from_file(src, output) def test_atomic(self): src = ''' |