Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
krux02 committed Feb 5, 2020
1 parent 5fcc19f commit 4d48efd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 29 deletions.
5 changes: 2 additions & 3 deletions tests/errmsgs/tsigmatch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ proc f(a1: string; a2: varargs[string]; a3: float; a4: var string)
required type for a4: var string
but expression '"bad"' is immutable, not 'var'
expression: f("asdf", "1", "2", "3", "4", 2.3, "bad")
expression: f("asdf", "1", "2", "3", "4", 2.25, "bad")
tsigmatch.nim(164, 4) Error: type mismatch: got <string, a0: int literal(12)>
but expected one of:
proc f(x: string; a0: var int)
Expand Down Expand Up @@ -153,7 +153,7 @@ block:
# sigmatch gets confused with param/arg position after varargs
proc f(a1: int) = discard
proc f(a1: string, a2: varargs[string], a3: float, a4: var string) = discard
f("asdf", "1", "2", "3", "4", 2.3, "bad")
f("asdf", "1", "2", "3", "4", 2.25, "bad")

block:
# bug: https://github.com/nim-lang/Nim/issues/11061#issuecomment-508970046
Expand All @@ -169,4 +169,3 @@ block:
proc fun1(a1: MyInt, a2: Mystring) = discard
proc fun1(a1: float, a2: Mystring) = discard
fun1(Mystring.default, "asdf")

25 changes: 8 additions & 17 deletions tests/float/tfloat6.nim
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
discard """
output: '''
1e-06 : 1e-06
1e-06 : 1e-06
0.001 : 0.001
1e-06 : 1e-06
1e-06 : 1e-06
10.000001 : 10.000001
100.000001 : 100.000001
'''
disabled: "windows"
disabled: "windows"
"""

import strutils

echo "0.00_0001".parseFloat(), " : ", 1E-6
echo "0.00__00_01".parseFloat(), " : ", 1E-6
echo "0.0_01".parseFloat(), " : ", 0.001
echo "0.00_000_1".parseFloat(), " : ", 1E-6
echo "0.00000_1".parseFloat(), " : ", 1E-6
doAssert "0.00_0001".parseFloat() == 1E-6
doAssert "0.00__00_01".parseFloat() == 1E-6
doAssert "0.0_01".parseFloat() == 0.001
doAssert "0.00_000_1".parseFloat() == 1E-6
doAssert "0.00000_1".parseFloat() == 1E-6

echo "1_0.00_0001".parseFloat(), " : ", 10.000001
echo "1__00.00_0001".parseFloat(), " : ", 1_00.000001
doAssert "1_0.00_0001".parseFloat() == 10.000001
doAssert "1__00.00_0001".parseFloat() == 1_00.000001
6 changes: 3 additions & 3 deletions tests/objects/t12753.nim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
discard """
output: '''
(v: [(v: [0.0, 1.1]), (v: [2.2, 3.3])])
(v: [(v: [0.0, 1.1]), (v: [2.2, 3.3])])
(v: [(v: [0.0, 1.125]), (v: [2.25, 3.375])])
(v: [(v: [0.0, 1.125]), (v: [2.25, 3.375])])
'''
"""

Expand All @@ -13,7 +13,7 @@ type

var
a = M(v:[ V(v:[0.0,1.0]), V(v:[2.0,3.0]) ])
b = M(v:[ V(v:[0.0,0.1]), V(v:[0.2,0.3]) ])
b = M(v:[ V(v:[0.0,0.125]), V(v:[0.25,0.375]) ])

echo M(v: [V(v: [b.v[0].v[0] + a.v[0].v[0], b.v[0].v[1] + a.v[0].v[1]]),
V(v: [b.v[1].v[0] + a.v[1].v[0], b.v[1].v[1] + a.v[1].v[1]])])
Expand Down
4 changes: 2 additions & 2 deletions tests/showoff/tdrdobbs_examples.nim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
discard """
output: '''108
11 -1 1936
0.4
0.5
true
truefalse'''
"""
Expand Down Expand Up @@ -75,7 +75,7 @@ proc evaluate(n: Formula, varToVal: proc (name: string): float): float =
of fkMul: evaluate(n.left, varToVal) * evaluate(n.right, varToVal)
of fkExp: pow(evaluate(n.left, varToVal), evaluate(n.right, varToVal))

echo evaluate(Formula(kind: fkLit, value: 0.4), nil)
echo evaluate(Formula(kind: fkLit, value: 0.5), nil)

proc isPolyTerm(n: Formula): bool =
n.kind == fkMul and n.left.kind == fkLit and (let e = n.right;
Expand Down
4 changes: 0 additions & 4 deletions tests/system/tostring.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ doAssert """["", "foo", "bar"]""" == $(@["", "foo", "bar"].toOpenArray(0, 2))
# bug #2395
let alphaSet: set[char] = {'a'..'c'}
doAssert "{'a', 'b', 'c'}" == $alphaSet
doAssert "2.3242" == $(2.3242)
doAssert "2.982" == $(2.982)
doAssert "123912.1" == $(123912.1)
doAssert "123912.1823" == $(123912.1823)
doAssert "5.0" == $(5.0)
doAssert "1e+100" == $(1e100)
doAssert "inf" == $(1e1000000)
Expand Down

0 comments on commit 4d48efd

Please sign in to comment.