aboutsummaryrefslogtreecommitdiff
path: root/tests/test_core.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_core.py')
-rw-r--r--tests/test_core.py84
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 = '''