mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-04 06:23:06 +00:00
fix(tests): auto import all tests files and fix forgotten tests (#1281)
This commit is contained in:
parent
7b660e3554
commit
e1c397e112
@ -34,26 +34,26 @@ suite "Test coders":
|
|||||||
StoreResult(kind: rand(StoreResultKind), used: rand(NBytes))
|
StoreResult(kind: rand(StoreResultKind), used: rand(NBytes))
|
||||||
|
|
||||||
test "Natural encode/decode":
|
test "Natural encode/decode":
|
||||||
for val in newSeqWith[Natural](100, rand(Natural)) & @[Natural.low, Natural.high]:
|
for val in newSeqWith(100, rand(Natural)) & @[Natural.low, Natural.high]:
|
||||||
check:
|
check:
|
||||||
success(val) == Natural.decode(encode(val))
|
success(val) == Natural.decode(encode(val))
|
||||||
|
|
||||||
test "QuotaUsage encode/decode":
|
test "QuotaUsage encode/decode":
|
||||||
for val in newSeqWith[QuotaUsage](100, rand(QuotaUsage)):
|
for val in newSeqWith(100, rand(QuotaUsage)):
|
||||||
check:
|
check:
|
||||||
success(val) == QuotaUsage.decode(encode(val))
|
success(val) == QuotaUsage.decode(encode(val))
|
||||||
|
|
||||||
test "BlockMetadata encode/decode":
|
test "BlockMetadata encode/decode":
|
||||||
for val in newSeqWith[BlockMetadata](100, rand(BlockMetadata)):
|
for val in newSeqWith(100, rand(BlockMetadata)):
|
||||||
check:
|
check:
|
||||||
success(val) == BlockMetadata.decode(encode(val))
|
success(val) == BlockMetadata.decode(encode(val))
|
||||||
|
|
||||||
test "DeleteResult encode/decode":
|
test "DeleteResult encode/decode":
|
||||||
for val in newSeqWith[DeleteResult](100, rand(DeleteResult)):
|
for val in newSeqWith(100, rand(DeleteResult)):
|
||||||
check:
|
check:
|
||||||
success(val) == DeleteResult.decode(encode(val))
|
success(val) == DeleteResult.decode(encode(val))
|
||||||
|
|
||||||
test "StoreResult encode/decode":
|
test "StoreResult encode/decode":
|
||||||
for val in newSeqWith[StoreResult](100, rand(StoreResult)):
|
for val in newSeqWith(100, rand(StoreResult)):
|
||||||
check:
|
check:
|
||||||
success(val) == StoreResult.decode(encode(val))
|
success(val) == StoreResult.decode(encode(val))
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import std/random
|
|||||||
import std/sequtils
|
import std/sequtils
|
||||||
import pkg/chronos
|
import pkg/chronos
|
||||||
import pkg/questionable/results
|
import pkg/questionable/results
|
||||||
|
import pkg/libp2p
|
||||||
import pkg/codex/blocktype as bt
|
import pkg/codex/blocktype as bt
|
||||||
import pkg/codex/stores/repostore
|
import pkg/codex/stores/repostore
|
||||||
import pkg/codex/clock
|
import pkg/codex/clock
|
||||||
|
|||||||
16
tests/imports.nim
Normal file
16
tests/imports.nim
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import std/macros
|
||||||
|
import std/os
|
||||||
|
import std/strutils
|
||||||
|
|
||||||
|
macro importTests*(dir: static string): untyped =
|
||||||
|
## imports all files in the specified directory whose filename
|
||||||
|
## starts with "test" and ends in ".nim"
|
||||||
|
let imports = newStmtList()
|
||||||
|
for file in walkDirRec(dir):
|
||||||
|
let (_, name, ext) = splitFile(file)
|
||||||
|
if name.startsWith("test") and ext == ".nim":
|
||||||
|
imports.add(
|
||||||
|
quote do:
|
||||||
|
import `file`
|
||||||
|
)
|
||||||
|
imports
|
||||||
@ -1,21 +1,6 @@
|
|||||||
import ./codex/teststores
|
import std/os
|
||||||
import ./codex/testblockexchange
|
import ./imports
|
||||||
import ./codex/testasyncheapqueue
|
|
||||||
import ./codex/testchunking
|
importTests(currentSourcePath().parentDir() / "codex")
|
||||||
import ./codex/testlogutils
|
|
||||||
import ./codex/testmanifest
|
|
||||||
import ./codex/testnode
|
|
||||||
import ./codex/teststorestream
|
|
||||||
import ./codex/testpurchasing
|
|
||||||
import ./codex/testsales
|
|
||||||
import ./codex/testerasure
|
|
||||||
import ./codex/testutils
|
|
||||||
import ./codex/testclock
|
|
||||||
import ./codex/testsystemclock
|
|
||||||
import ./codex/testvalidation
|
|
||||||
import ./codex/testasyncstreamwrapper
|
|
||||||
import ./codex/testmerkletree
|
|
||||||
import ./codex/testslots
|
|
||||||
import ./codex/testindexingstrategy
|
|
||||||
|
|
||||||
{.warning[UnusedImport]: off.}
|
{.warning[UnusedImport]: off.}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import ./contracts/testContracts
|
import std/os
|
||||||
import ./contracts/testMarket
|
import ./imports
|
||||||
import ./contracts/testDeployment
|
|
||||||
import ./contracts/testClock
|
importTests(currentSourcePath().parentDir() / "contracts")
|
||||||
import ./contracts/testProvider
|
|
||||||
|
|
||||||
{.warning[UnusedImport]: off.}
|
{.warning[UnusedImport]: off.}
|
||||||
|
|||||||
@ -1,14 +1,6 @@
|
|||||||
import ./integration/testcli
|
import std/os
|
||||||
import ./integration/testrestapi
|
import ./imports
|
||||||
import ./integration/testrestapivalidation
|
|
||||||
import ./integration/testupdownload
|
importTests(currentSourcePath().parentDir() / "integration")
|
||||||
import ./integration/testsales
|
|
||||||
import ./integration/testpurchasing
|
|
||||||
import ./integration/testblockexpiration
|
|
||||||
import ./integration/testmarketplace
|
|
||||||
import ./integration/testproofs
|
|
||||||
import ./integration/testvalidator
|
|
||||||
import ./integration/testecbug
|
|
||||||
import ./integration/testslotrepair
|
|
||||||
|
|
||||||
{.warning[UnusedImport]: off.}
|
{.warning[UnusedImport]: off.}
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
import ./tools/cirdl/testcirdl
|
import std/os
|
||||||
|
import ./imports
|
||||||
|
|
||||||
|
importTests(currentSourcePath().parentDir() / "tools")
|
||||||
|
|
||||||
{.warning[UnusedImport]: off.}
|
{.warning[UnusedImport]: off.}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user