Mercurial > games > semicongine
diff tests/test_storage.nim @ 1099:1205e7757732
add: enforce adding default value for storage loads
author | sam <sam@basx.dev> |
---|---|
date | Sun, 07 Apr 2024 22:19:39 +0700 |
parents | 45cf94a6535c |
children | 71315636ba82 |
line wrap: on
line diff
--- a/tests/test_storage.nim Sun Apr 07 21:56:43 2024 +0700 +++ b/tests/test_storage.nim Sun Apr 07 22:19:39 2024 +0700 @@ -8,17 +8,17 @@ const KEY = "test" # get default - assert load[int](storage, KEY) == default(type(TEST_VALUE)) + assert storage.load(KEY, 0) == default(type(TEST_VALUE)) # save and load custom store(storage, KEY, TEST_VALUE) - assert load[int](storage, KEY) == TEST_VALUE + assert storage.load(KEY, 0) == TEST_VALUE proc stressTest(storage: StorageType) = for i in 1 .. 10000: let key = &"key-{i}" store(storage, key, i) - assert load[int](storage, key) == i + assert storage.load(key, 0) == i proc main() = SystemStorage.purge()