diff tests/test_storage.nim @ 1139:114f395b9144

did: finish refactoring and updated all tests accordingly
author sam <sam@basx.dev>
date Sat, 08 Jun 2024 14:58:25 +0700
parents 71315636ba82
children
line wrap: on
line diff
--- a/tests/test_storage.nim	Tue Jun 04 22:08:48 2024 +0700
+++ b/tests/test_storage.nim	Sat Jun 08 14:58:25 2024 +0700
@@ -7,32 +7,32 @@
   const KEY = "test"
 
   # get default
-  assert storage.load(KEY, 0) == default(type(TEST_VALUE))
+  assert storage.Load(KEY, 0) == default(type(TEST_VALUE))
 
   # save and load custom
-  store(storage, KEY, TEST_VALUE)
-  assert storage.load(KEY, 0) == TEST_VALUE
+  Store(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 storage.load(key, 0) == i
+    Store(storage, key, i)
+    assert storage.Load(key, 0) == i
 
 proc main() =
-  SystemStorage.purge()
+  SystemStorage.Purge()
   echo "SystemStorage: Testing simple store/load"
   SystemStorage.testSimple()
 
-  UserStorage.purge()
+  UserStorage.Purge()
   echo "UserStorage: Testing simple store/load"
   UserStorage.testSimple()
 
   echo "Stress test with 10'000 saves/loads"
   SystemStorage.stressTest()
 
-  SystemStorage.purge()
-  UserStorage.purge()
+  SystemStorage.Purge()
+  UserStorage.Purge()
 
 
 when isMainModule: