mirror of
https://github.com/status-im/nim-serialization.git
synced 2025-01-12 21:05:21 +00:00
Add roundtrip tests for tables
This commit is contained in:
parent
897a6638cf
commit
e97e0b0684
@ -1,5 +1,5 @@
|
||||
import
|
||||
unittest, times, typetraits, random, strutils, options, sets,
|
||||
unittest, times, typetraits, random, strutils, options, sets, tables,
|
||||
faststreams/input_stream,
|
||||
../../serialization, ../object_serialization
|
||||
|
||||
@ -226,6 +226,19 @@ proc executeRoundtripTests*(Format: type) =
|
||||
roundtrip l2
|
||||
roundtrip l3
|
||||
|
||||
test "tables":
|
||||
var
|
||||
t1 = {"test": 0, "other": 1}.toTable()
|
||||
t2 = {"test": 0, "other": 1}.toOrderedTable()
|
||||
t3 = newTable[string, int]()
|
||||
|
||||
t3["test"] = 0
|
||||
t3["other"] = 1
|
||||
|
||||
roundtrip t1
|
||||
roundtrip t2
|
||||
roundtrip t3
|
||||
|
||||
test "sets":
|
||||
var s1 = toSet([1, 2, 3, 1, 4, 2])
|
||||
var s2 = HoldsSet(a: 100, s: toSet(["a", "b", "c"]))
|
||||
|
Loading…
x
Reference in New Issue
Block a user