-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
523447e
commit 87dfcd1
Showing
12 changed files
with
187 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
|
||
BUILTINS = ['cast', | ||
'int', | ||
'float', | ||
'isinstance', | ||
'bool', | ||
'len', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tests/functional/translation/float_ieee32/test_non_float.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Any copyright is dedicated to the Public Domain. | ||
# http://creativecommons.org/publicdomain/zero/1.0/ | ||
|
||
from nagini_contracts.contracts import * | ||
|
||
def specialVals() -> None: | ||
#:: ExpectedOutput(invalid.program:invalid.float.val) | ||
nan = float("asdasd") | ||
nf = float("inF") | ||
one = float("1.0") | ||
Assert(nf > one) | ||
Assert(not nan == nan) | ||
Assert(nan == nan) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Any copyright is dedicated to the Public Domain. | ||
# http://creativecommons.org/publicdomain/zero/1.0/ | ||
|
||
from nagini_contracts.contracts import * | ||
|
||
def specialVals() -> None: | ||
#:: ExpectedOutput(invalid.program:invalid.float.val) | ||
nan = float("asdasd") | ||
nf = float("inF") | ||
one = float("1.0") | ||
Assert(nf > one) | ||
Assert(not nan == nan) | ||
Assert(nan == nan) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Any copyright is dedicated to the Public Domain. | ||
# http://creativecommons.org/publicdomain/zero/1.0/ | ||
|
||
from nagini_contracts.contracts import * | ||
|
||
def specialVals() -> None: | ||
#:: ExpectedOutput(invalid.program:non.real.float) | ||
nan = float("nan") | ||
nf = float("inF") | ||
one = float("1.0") | ||
Assert(nf > one) | ||
Assert(not nan == nan) | ||
Assert(nan == nan) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
tests/functional/verification/float_ieee32/test_float_long.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Any copyright is dedicated to the Public Domain. | ||
# http://creativecommons.org/publicdomain/zero/1.0/ | ||
|
||
#:: IgnoreFile(158) | ||
# Ignore this file because it non-deterministically takes very long. | ||
|
||
from nagini_contracts.contracts import * | ||
|
||
def useOps(f: float, g: float) -> float: | ||
a = f - g | ||
b = f * g | ||
c = f > g | ||
d = f >= g | ||
e = f < g | ||
e2 = f <= g | ||
asd = 1 / 2 | ||
return f | ||
|
||
def specialVals() -> None: | ||
nan = float("nan") | ||
nf = float("inF") | ||
one = float("1.0") | ||
Assert(nf > one) | ||
Assert(not nan == nan) | ||
#:: ExpectedOutput(assert.failed:assertion.false) | ||
Assert(nan == nan) | ||
|
||
|
||
def cmpLits() -> None: | ||
Assert(3.0 > 2.0) | ||
Assert(1.0 <= 40.0) | ||
|
||
def sqr3(num : float) -> float: | ||
Requires(num >= 0.0) | ||
#:: ExpectedOutput(postcondition.violated:assertion.false) | ||
Ensures(Result() > 0.0) | ||
Ensures(num * num == Result()) | ||
return num * num | ||
|
||
def arith(num: float) -> float: | ||
Requires(num == num) # not NaN | ||
Ensures(Result() == num + 3.0) | ||
tmp = 1.0 + 2.0 | ||
return num + tmp | ||
|
||
|
||
def arith3(num: float) -> float: | ||
#:: ExpectedOutput(postcondition.violated:assertion.false) | ||
Ensures(Result() == num + 3.0) | ||
return num + 3.0 | ||
|
||
|
||
def arith2(num: float) -> float: | ||
Requires(num == num) # not NaN | ||
#:: ExpectedOutput(postcondition.violated:assertion.false) | ||
Ensures(Result() == num + 4.0) | ||
return num + 1.0 + 2.0 | ||
|
||
|
||
def intComp() -> None: | ||
a = 3.0 | ||
b = 3 | ||
#:: UnexpectedOutput(assert.failed:assertion.false,158) | ||
Assert(a == b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters