aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/core/test_strptime_tm.in21
-rw-r--r--tests/core/test_strptime_tm.out1
-rw-r--r--tests/test_core.py24
3 files changed, 25 insertions, 21 deletions
diff --git a/tests/core/test_strptime_tm.in b/tests/core/test_strptime_tm.in
new file mode 100644
index 00000000..29e40223
--- /dev/null
+++ b/tests/core/test_strptime_tm.in
@@ -0,0 +1,21 @@
+
+ #include <time.h>
+ #include <stdio.h>
+ #include <string.h>
+
+ int main() {
+ struct tm tm;
+ char *ptr = strptime("17410105012000", "%H%M%S%d%m%Y", &tm);
+
+ printf("%s: %s, %d/%d/%d %d:%d:%d",
+ (ptr != NULL && *ptr=='\0') ? "OK" : "ERR",
+ tm.tm_wday == 0 ? "Sun" : (tm.tm_wday == 1 ? "Mon" : (tm.tm_wday == 2 ? "Tue" : (tm.tm_wday == 3 ? "Wed" : (tm.tm_wday == 4 ? "Thu" : (tm.tm_wday == 5 ? "Fri" : (tm.tm_wday == 6 ? "Sat" : "ERR")))))),
+ tm.tm_mon+1,
+ tm.tm_mday,
+ tm.tm_year+1900,
+ tm.tm_hour,
+ tm.tm_min,
+ tm.tm_sec
+ );
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_strptime_tm.out b/tests/core/test_strptime_tm.out
new file mode 100644
index 00000000..32c321f7
--- /dev/null
+++ b/tests/core/test_strptime_tm.out
@@ -0,0 +1 @@
+OK: Wed, 1/5/2000 17:41:1 \ No newline at end of file
diff --git a/tests/test_core.py b/tests/test_core.py
index 545e990d..8c19c916 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -2462,28 +2462,10 @@ The current type of b is: 9
self.do_run_from_file(src, output)
def test_strptime_tm(self):
- src=r'''
- #include <time.h>
- #include <stdio.h>
- #include <string.h>
+ test_path = path_from_root('tests', 'core', 'test_strptime_tm')
+ src, output = (test_path + s for s in ('.in', '.out'))
- int main() {
- struct tm tm;
- char *ptr = strptime("17410105012000", "%H%M%S%d%m%Y", &tm);
-
- printf("%s: %s, %d/%d/%d %d:%d:%d",
- (ptr != NULL && *ptr=='\0') ? "OK" : "ERR",
- tm.tm_wday == 0 ? "Sun" : (tm.tm_wday == 1 ? "Mon" : (tm.tm_wday == 2 ? "Tue" : (tm.tm_wday == 3 ? "Wed" : (tm.tm_wday == 4 ? "Thu" : (tm.tm_wday == 5 ? "Fri" : (tm.tm_wday == 6 ? "Sat" : "ERR")))))),
- tm.tm_mon+1,
- tm.tm_mday,
- tm.tm_year+1900,
- tm.tm_hour,
- tm.tm_min,
- tm.tm_sec
- );
- }
- '''
- self.do_run(src, 'OK: Wed, 1/5/2000 17:41:1')
+ self.do_run_from_file(src, output)
def test_strptime_days(self):
src = r'''