Skip to content

Commit

Permalink
tests: added unit tests for db module
Browse files Browse the repository at this point in the history
FossilOrigin-Name: 33d849332246700a15851fc8340fec963c3b14a2e33945704e986a0a802ee85d
  • Loading branch information
thindil committed Nov 26, 2023
1 parent d5aa7fa commit 7294830
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/db.nim
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 7294830

Please sign in to comment.