diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/system/alloc.nim | 37 | ||||
-rw-r--r-- | tests/testament/htmlgen.nim | 18 |
2 files changed, 40 insertions, 15 deletions
diff --git a/tests/system/alloc.nim b/tests/system/alloc.nim index 665b448ac..7abefec2a 100644 --- a/tests/system/alloc.nim +++ b/tests/system/alloc.nim @@ -2,44 +2,51 @@ var x: ptr int x = cast[ptr int](alloc(7)) assert x != nil - -x = alloc(int, 3) +x = cast[ptr int](x.realloc(2)) assert x != nil x.dealloc() -x = alloc0(int, 4) +x = createU(int, 3) +assert x != nil +x.free() + +x = create(int, 4) assert cast[ptr array[4, int]](x)[0] == 0 assert cast[ptr array[4, int]](x)[1] == 0 assert cast[ptr array[4, int]](x)[2] == 0 assert cast[ptr array[4, int]](x)[3] == 0 -x = cast[ptr int](x.realloc(2)) -assert x != nil - -x = x.reallocType(4) +x = x.resize(4) assert x != nil -x.dealloc() +x.free() x = cast[ptr int](allocShared(100)) assert x != nil deallocShared(x) -x = allocShared(int, 3) +x = createSharedU(int, 3) assert x != nil -x.deallocShared() +x.freeShared() -x = allocShared0(int, 3) +x = createShared(int, 3) assert x != nil assert cast[ptr array[3, int]](x)[0] == 0 assert cast[ptr array[3, int]](x)[1] == 0 assert cast[ptr array[3, int]](x)[2] == 0 -x = cast[ptr int](reallocShared(x, 2)) assert x != nil +x = cast[ptr int](x.resizeShared(2)) +assert x != nil +x.freeShared() -x = reallocType(x, 12) +x = create(int, 10) assert x != nil +x = x.resize(12) +assert x != nil +x.dealloc() -x = reallocSharedType(x, 1) +x = createShared(int, 1) +assert x != nil +x = x.resizeShared(1) assert x != nil -x.deallocShared() +x.freeShared() diff --git a/tests/testament/htmlgen.nim b/tests/testament/htmlgen.nim index 74d8811b8..89d56c693 100644 --- a/tests/testament/htmlgen.nim +++ b/tests/testament/htmlgen.nim @@ -174,6 +174,10 @@ proc generateJson*(filename: string, commit: int) = on A.name = B.name and A.category = B.category where A.[commit] = ? and B.[commit] = ? and A.machine = ? and A.result != B.result""" + selResults = """select + name, category, target, action, result, expected, given + from TestResult + where [commit] = ?""" var db = open(connection="testament.db", user="testament", password="", database="testament") let lastCommit = db.getCommit(commit) @@ -189,6 +193,20 @@ proc generateJson*(filename: string, commit: int) = outfile.writeln("""{"total": $#, "passed": $#, "skipped": $#""" % data) + let results = newJArray() + for row in db.rows(sql(selResults), lastCommit): + var obj = newJObject() + obj["name"] = %row[0] + obj["category"] = %row[1] + obj["target"] = %row[2] + obj["action"] = %row[3] + obj["result"] = %row[4] + obj["expected"] = %row[5] + obj["given"] = %row[6] + results.add(obj) + outfile.writeln(""", "results": """) + outfile.write(results.pretty) + if not previousCommit.isNil: let diff = newJArray() |