diff options
author | Araq <rumpf_a@web.de> | 2014-03-27 21:24:53 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-03-27 21:24:53 +0100 |
commit | 5a51a25fd0d534b0001ee47370379ab05da108a4 (patch) | |
tree | 5811d3b84ae4f327b76b3322e88f6d271fe99178 /tests/stdlib | |
parent | 31cfed0aa894caeb2dcd6d68f6465d62b0271044 (diff) | |
parent | f40625f5c4634a426fa4e181abf54e0ffbe52d88 (diff) | |
download | Nim-5a51a25fd0d534b0001ee47370379ab05da108a4.tar.gz |
Merge branch 'devel' of https://github.com/Araq/Nimrod into devel
Diffstat (limited to 'tests/stdlib')
-rw-r--r-- | tests/stdlib/talgorithm.nim | 3 | ||||
-rw-r--r-- | tests/stdlib/tmath.nim | 14 |
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/stdlib/talgorithm.nim b/tests/stdlib/talgorithm.nim index 7ab652c82..3ca425fbc 100644 --- a/tests/stdlib/talgorithm.nim +++ b/tests/stdlib/talgorithm.nim @@ -6,3 +6,6 @@ doAssert product(@[@[1,2]]) == @[@[1,2]], "a simple case of one element" doAssert product(@[@[1,2], @[3,4]]) == @[@[2,4],@[1,4],@[2,3],@[1,3]], "two elements" doAssert product(@[@[1,2], @[3,4], @[5,6]]) == @[@[2,4,6],@[1,4,6],@[2,3,6],@[1,3,6], @[2,4,5],@[1,4,5],@[2,3,5],@[1,3,5]], "three elements" doAssert product(@[@[1,2], @[]]) == newSeq[seq[int]](), "two elements, but one empty" +doAssert lowerBound([1,2,4], 3, system.cmp[int]) == 2 +doAssert lowerBound([1,2,2,3], 4, system.cmp[int]) == 4 +doAssert lowerBound([1,2,3,10], 11) == 4 \ No newline at end of file diff --git a/tests/stdlib/tmath.nim b/tests/stdlib/tmath.nim index a86a3b84c..fc9486093 100644 --- a/tests/stdlib/tmath.nim +++ b/tests/stdlib/tmath.nim @@ -23,6 +23,13 @@ suite "random int": rand = random(100..1000) check rand < 1000 check rand >= 100 + test "randomize() again gives new numbers": + randomize() + var rand1 = random(1000000) + randomize() + var rand2 = random(1000000) + check rand1 != rand2 + suite "random float": test "there might be some randomness": @@ -45,3 +52,10 @@ suite "random float": rand = random(100.0..1000.0) check rand < 1000.0 check rand >= 100.0 + test "randomize() again gives new numbers": + randomize() + var rand1:float = random(1000000.0) + randomize() + var rand2:float = random(1000000.0) + check rand1 != rand2 + |