aboutsummaryrefslogtreecommitdiff
path: root/tests/ttypechecker.nim
diff options
context:
space:
mode:
authorhistoria <gravel.justness270@slmail.me>2024-08-04 04:16:20 -0400
committerhistoria <gravel.justness270@slmail.me>2024-08-04 04:16:20 -0400
commit0a87208f4cad82cfe7dd33c7fbcbcd7cc0d1e219 (patch)
treeb2c7b4ae5a21392f9cffe90256775bad7c832eac /tests/ttypechecker.nim
parent4e0d54d5cb8d6fdd96bf8d1cd054554bb954611b (diff)
downloadsoon-0a87208f4cad82cfe7dd33c7fbcbcd7cc0d1e219.tar.gz
Fixing gitignore
Diffstat (limited to 'tests/ttypechecker.nim')
-rw-r--r--tests/ttypechecker.nim77
1 files changed, 77 insertions, 0 deletions
diff --git a/tests/ttypechecker.nim b/tests/ttypechecker.nim
new file mode 100644
index 0000000..ee81fc4
--- /dev/null
+++ b/tests/ttypechecker.nim
@@ -0,0 +1,77 @@
+import then/typechecker
+import std/[unittest]
+
+test "Testing typechecker":
+ for t in ["2024","0001","9999"]:
+ check checkType(t) == "year"
+
+ for t in ["01","1","31"]:
+ check checkType(t) == "day"
+
+ for t in ["1w","1W","9W"]:
+ check checkType(t) == "firstweek"
+
+ for t in ["1l","1L","9L"]:
+ check checkType(t) == "lastweek"
+
+ for t in [
+ "(jan 1 2024)",
+ "(Jan 31 2024)",
+ "(January 1 2024)",
+ "(2024 1 jan)",
+ "(1 jan 2024)",
+ "(jan 1)",
+ "(jan 31)",
+ "(january 1)"]:
+ check checkType(t) == "dategroup"
+
+ for t in ["2024-2025","0000-9999"]:
+ check checkType(t) == "rangeyear"
+
+ for t in ["1-2","01-2","01-02","1-02","1-31","10-31"]:
+ check checkType(t) == "rangeday"
+
+ for t in [
+ "00:00",
+ "23:23",
+ "00:00",
+ "23:00",
+ "01:00-12:30",
+ "1:30-12:30",
+ "1am",
+ "1pm",
+ "1AM",
+ "1PM",
+ "1am-2pm",
+ "1PM-2PM",
+ "1:00pm-2:00pm",
+ "12:00am-12:00pm"]:
+ check checkType(t) == "time"
+
+ for t in [
+ "j%2",
+ "J%2",
+ "J%999",
+ "j%2+1",
+ "j%2-1",
+ "(j%2-1)",
+ "(j % 2 - 1)"]:
+ check checkType(t) == "julian"
+
+ for t in ["Jan","jan","JANUARY","JAN","jAN"]:
+ check checkType(t) == "month"
+
+ for t in ["Mon","mon","MONDAY","MON","mON"]:
+ check checkType(t) == "weekday"
+
+ for t in ["jan-feb","JAN-FEB","Jan-Feb","january-february"]:
+ check checkType(t) == "rangemonth"
+
+ for t in ["mon-tue","MON-TUE","Mon-Tue","monday-tuesday"]:
+ check checkType(t) == "rangeweekday"
+
+ for t in ["(Jan 31 2024)-(Feb 2 2024)","(2024 1 december)-(2025 2 january)"]:
+ check checkType(t) == "rangedategroup"
+
+ for t in ["!@#$","foo",""]:
+ check checkType(t) == "unknown"