update test
This commit is contained in:
parent
b3a80dd2eb
commit
0ef93bdea4
1 changed files with 13 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ discard """
|
||||||
output: '''StrictPositiveRange
|
output: '''StrictPositiveRange
|
||||||
float
|
float
|
||||||
range fail expected
|
range fail expected
|
||||||
|
range fail expected
|
||||||
'''
|
'''
|
||||||
"""
|
"""
|
||||||
import math, fenv
|
import math, fenv
|
||||||
|
|
@ -21,7 +22,6 @@ proc myoverload(x: Positive) =
|
||||||
proc myoverload(x: StrictPositive) =
|
proc myoverload(x: StrictPositive) =
|
||||||
echo "StrictPositiveRange"
|
echo "StrictPositiveRange"
|
||||||
|
|
||||||
|
|
||||||
let x = 9.0.StrictPositive
|
let x = 9.0.StrictPositive
|
||||||
myoverload(x)
|
myoverload(x)
|
||||||
myoverload(9.0)
|
myoverload(9.0)
|
||||||
|
|
@ -35,3 +35,15 @@ except:
|
||||||
echo "range fail expected"
|
echo "range fail expected"
|
||||||
|
|
||||||
|
|
||||||
|
proc strictOnlyProc(x: StrictPositive): bool =
|
||||||
|
if x > 1.0: true else: false
|
||||||
|
|
||||||
|
let x2 = 5.0.Positive
|
||||||
|
doAssert(strictOnlyProc(x2))
|
||||||
|
|
||||||
|
try:
|
||||||
|
let x4 = 0.0.Positive
|
||||||
|
discard strictOnlyProc(x4)
|
||||||
|
except:
|
||||||
|
echo "range fail expected"
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue