From e97e0b0684138bd899b1af6d44df27ccc7c7e982 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Fri, 2 Aug 2019 15:08:35 +0300 Subject: [PATCH] Add roundtrip tests for tables --- serialization/testing/generic_suite.nim | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/serialization/testing/generic_suite.nim b/serialization/testing/generic_suite.nim index abfa4c2..bbeedee 100644 --- a/serialization/testing/generic_suite.nim +++ b/serialization/testing/generic_suite.nim @@ -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"]))