From 7294830d70fec084caf0f4246d52ecefc22961fb Mon Sep 17 00:00:00 2001 From: thindil Date: Sun, 26 Nov 2023 05:38:05 +0000 Subject: [PATCH] tests: added unit tests for db module FossilOrigin-Name: 33d849332246700a15851fc8340fec963c3b14a2e33945704e986a0a802ee85d --- tests/db.nim | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/db.nim diff --git a/tests/db.nim b/tests/db.nim new file mode 100644 index 00000000..c328ec16 --- /dev/null +++ b/tests/db.nim @@ -0,0 +1,22 @@ +import std/tables +import ../src/[db, commandslist, lstring, resultcode] +import utils/utils +import unittest2 + +suite "Unit tests for db module": + + checkpoint "Initializing the tests" + let db = initDb("test15.db") + var commands = newTable[string, CommandData]() + + test "Initialization of the shell's database's commands": + initDb(db, commands) + check: + commands.len == 1 + + test "Optimizing the shell's database": + check: + optimizeDb(initLimitedString(capacity = 8, text = "optimize"), db) == QuitSuccess + + suiteTeardown: + closeDb(QuitSuccess.ResultCode, db)