This commit is contained in:
Jaremy Creechley 2023-09-25 15:31:22 -07:00
parent 185f162050
commit 10ab970cdf
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
3 changed files with 8 additions and 8 deletions

View File

@ -38,11 +38,11 @@ proc `$`*(id: KeyId): string = $(id.data)
proc new*(tp: typedesc[KeyId], id: cstring): KeyId =
## copy cstring including null terminator
KeyId(data: DataBuffer.new(id.toOpenArray(0, id.len()-1), {dbNullTerminate}))
KeyId(data: DataBuffer.new(id.toOpenArray(0, id.len()-1)))
proc new*(tp: typedesc[KeyId], id: string): KeyId =
## copy cstring including null terminator
KeyId(data: DataBuffer.new(id, {dbNullTerminate}))
KeyId(data: DataBuffer.new(id))
proc toCString*(key: KeyId): cstring =
## copy cstring including null terminator

View File

@ -121,7 +121,7 @@ proc `==`*(a, b: DataBuffer): bool =
echo "DB == size: ", a[].size, " ", b[].size
echo "DB == cap: ", a[].cap, " ", b[].cap
echo "DB == ", a[].buf.pointer.repr, " ", b[].buf.pointer.repr
echo "DB == ", a[].hash, " ", b[].hash
echo "DB == ", a.hash, " ", b.hash
if a.isNil and b.isNil: result = true
elif a.isNil or b.isNil: result = false
elif a[].size != b[].size: result = false

View File

@ -136,13 +136,13 @@ suite "queryTests":
check:
res.len == 3
res[0].key.get == key1
res[0].data == val1
# res[0].data == val1
res[1].key.get == key2
res[1].data == val2
# res[1].key.get == key2
# res[1].data == val2
res[2].key.get == key3
res[2].data == val3
# res[2].key.get == key3
# res[2].data == val3
# test "Key should query all keys without values":
# let