2023-08-28 18:22:53 -07:00
|
|
|
import std/options
|
|
|
|
|
import std/sequtils
|
|
|
|
|
import std/os
|
|
|
|
|
from std/algorithm import sort, reversed
|
|
|
|
|
|
2023-09-11 16:57:23 -07:00
|
|
|
import pkg/asynctest
|
2023-08-28 18:22:53 -07:00
|
|
|
import pkg/chronos
|
|
|
|
|
import pkg/stew/results
|
|
|
|
|
import pkg/stew/byteutils
|
|
|
|
|
|
2023-08-28 18:43:42 -07:00
|
|
|
import pkg/datastore/memoryds
|
2023-08-28 18:22:53 -07:00
|
|
|
|
|
|
|
|
import ./dscommontests
|
|
|
|
|
import ./querycommontests
|
|
|
|
|
|
|
|
|
|
suite "Test Basic MemoryDatastore":
|
|
|
|
|
let
|
|
|
|
|
key = Key.init("/a/b").tryGet()
|
|
|
|
|
bytes = "some bytes".toBytes
|
|
|
|
|
otherBytes = "some other bytes".toBytes
|
|
|
|
|
|
|
|
|
|
var
|
2023-08-28 18:43:42 -07:00
|
|
|
memStore: MemoryDatastore
|
2023-08-28 18:22:53 -07:00
|
|
|
|
|
|
|
|
setupAll:
|
2023-08-28 18:43:42 -07:00
|
|
|
memStore = MemoryDatastore.new()
|
2023-08-28 18:22:53 -07:00
|
|
|
|
2023-08-28 18:43:42 -07:00
|
|
|
basicStoreTests(memStore, key, bytes, otherBytes)
|
2023-08-28 18:22:53 -07:00
|
|
|
|
|
|
|
|
suite "Test Query":
|
|
|
|
|
|
2023-08-31 15:40:43 -07:00
|
|
|
var ds: MemoryDatastore
|
2023-08-28 18:22:53 -07:00
|
|
|
|
|
|
|
|
setup:
|
2023-08-28 18:43:42 -07:00
|
|
|
ds = MemoryDatastore.new()
|
2023-08-28 18:22:53 -07:00
|
|
|
|
|
|
|
|
queryTests(ds, false)
|