tests: add initial tests

Signed-off-by: Christopher Arndt <chris@chrisarndt.de>
This commit is contained in:
Christopher Arndt 2023-05-25 02:55:13 +02:00
parent bff6f5e9fa
commit 892d087c40
2 changed files with 22 additions and 0 deletions

View File

@ -1 +1,3 @@
--path:"../src/"
--warning[BareExcept]:off
--warning[UnusedImport]:off

20
tests/test_version.nim Normal file
View File

@ -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+"))