test generic

This commit is contained in:
Jaremy Creechley 2023-09-20 22:49:11 -07:00
parent cf2cbd3e1a
commit 937e1b79e8
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300

View File

@ -14,17 +14,12 @@ import pkg/datastore/key
import ../dscommontests
import ../querycommontests
suite "Test Basic SQLiteDatastore":
let
ds = SQLiteDatastore.new(Memory).tryGet()
keyFull = Key.init("a:b/c/d:e").tryGet()
key = keyFull.id()
bytes = "some bytes".toBytes
otherBytes = "some other bytes".toBytes
suiteTeardown:
ds.close().tryGet()
proc testBasic(
ds: SQLiteDatastore,
key: string,
bytes: seq[byte],
otherBytes: seq[byte],
) =
test "put":
ds.put(key, bytes).tryGet()
@ -76,3 +71,16 @@ suite "Test Basic SQLiteDatastore":
expect(DatastoreKeyNotFound):
discard ds.get(key).tryGet() # non existing key
suite "Test Basic SQLiteDatastore":
let
ds = SQLiteDatastore.new(Memory).tryGet()
keyFull = Key.init("a:b/c/d:e").tryGet()
key = keyFull.id()
bytes = "some bytes".toBytes
otherBytes = "some other bytes".toBytes
suiteTeardown:
ds.close().tryGet()
testBasic(ds, key, bytes, otherBytes)