import intsets import std/sets from sequtils import toSeq from algorithm import sorted proc sortedPairs[T](t: T): auto = toSeq(t.pairs).sorted template sortedItems(t: untyped): untyped = sorted(toSeq(t)) block: # we use HashSet as groundtruth, it's well tested elsewhere template testDel(t, t0) = template checkEquals() = doAssert t.len == t0.len for k in t0: doAssert k in t for k in t: doAssert k in t0 doAssert sortedItems(t) == sortedItems(t0) template incl2(i) = t.incl i t0.incl i template excl2(i) = t.excl i t0.excl i block: var expected: seq[int] let n = 100 let n2 = n*2 for i in 0..