mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 19:52:36 +00:00
update test
This commit is contained in:
@@ -3,6 +3,7 @@ discard """
|
||||
output: '''StrictPositiveRange
|
||||
float
|
||||
range fail expected
|
||||
range fail expected
|
||||
'''
|
||||
"""
|
||||
import math, fenv
|
||||
@@ -21,7 +22,6 @@ proc myoverload(x: Positive) =
|
||||
proc myoverload(x: StrictPositive) =
|
||||
echo "StrictPositiveRange"
|
||||
|
||||
|
||||
let x = 9.0.StrictPositive
|
||||
myoverload(x)
|
||||
myoverload(9.0)
|
||||
@@ -35,3 +35,15 @@ except:
|
||||
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"
|
||||
|
||||
Reference in New Issue
Block a user