From 892d087c4025dfbb533f35d4cd7a0eb8fcf42891 Mon Sep 17 00:00:00 2001 From: Christopher Arndt Date: Thu, 25 May 2023 02:55:13 +0200 Subject: [PATCH] tests: add initial tests Signed-off-by: Christopher Arndt --- tests/nim.cfg | 2 ++ tests/test_version.nim | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 tests/test_version.nim diff --git a/tests/nim.cfg b/tests/nim.cfg index 85bf6c4..89f9c5b 100644 --- a/tests/nim.cfg +++ b/tests/nim.cfg @@ -1 +1,3 @@ --path:"../src/" +--warning[BareExcept]:off +--warning[UnusedImport]:off diff --git a/tests/test_version.nim b/tests/test_version.nim new file mode 100644 index 0000000..5d42150 --- /dev/null +++ b/tests/test_version.nim @@ -0,0 +1,20 @@ +import std/[re, strformat, unittest] +import jacket + +suite "test version": + test "getVersion": + var major, minor, micro, proto: cint + getVersion(major.addr, minor.addr, micro.addr, proto.addr) + #echo fmt"{major}.{minor}.{micro} proto {proto}" + check: + # yes, the function simply returns 0 for all vars :-D + major == 0 + minor == 0 + micro == 0 + proto == 0 + test "getVersionString": + let version = getVersionString() + #echo $version + check: + $typeof(version) == "cstring" + match($version, re(r"\d+\.\d+\.\d+"))