From 0a87208f4cad82cfe7dd33c7fbcbcd7cc0d1e219 Mon Sep 17 00:00:00 2001 From: historia Date: Sun, 4 Aug 2024 04:16:20 -0400 Subject: Fixing gitignore --- tests/ttypechecker.nim | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 tests/ttypechecker.nim (limited to 'tests/ttypechecker.nim') 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" -- cgit v1.2.3