Mercurial > games > semicongine
diff tests/test_storage.nim @ 988:46778940c1d7
tmp: move stuff to notebook
author | sam <sam@basx.dev> |
---|---|
date | Sun, 07 Apr 2024 20:12:52 +0700 |
parents | 49d73ed5a1ec |
children | 3e0116b5d2ed |
line wrap: on
line diff
--- a/tests/test_storage.nim Sun Apr 07 01:17:40 2024 +0700 +++ b/tests/test_storage.nim Sun Apr 07 20:12:52 2024 +0700 @@ -3,6 +3,7 @@ import semicongine +#[ proc testSimple(storage: StorageType) = const TEST_VALUE = 42 const KEY = "test" @@ -43,6 +44,7 @@ p.awaitStored() var p1 = load[int](storage, key) assert p1.awaitResult() == i +]# proc concurrentStressTest(storage: StorageType) = var storeFutures: seq[StoreFuture[int]] @@ -50,7 +52,8 @@ for i in 1 .. 10000: let key = &"key-{i}" echo key - storeFutures.add store(storage, key, i) + store() + # storeFutures.add store(storage, key, i) for i in 1 .. 10000: echo i @@ -59,6 +62,7 @@ var p1 = load[int](storage, key) assert p1.awaitResult() == i +#[ proc main() = SystemStorage.purge() echo "SystemStorage: Testing simple store/load" @@ -81,6 +85,9 @@ # TODO: fails currently, but is likely not too important # echo "Stress test with 10'000 saves/loads and a little concurrency" # SystemStorage.concurrentStressTest() +]# when isMainModule: - main() + echo "Stress test with 10'000 saves/loads and a little concurrency" + SystemStorage.concurrentStressTest() + # main()