-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Use the right comparison operators for JS bitvectors and Go ordi…
- Loading branch information
1 parent
a969ac0
commit 968595c
Showing
5 changed files
with
184 additions
and
11 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
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 |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// RUN: %dafny /compile:0 "%s" > "%t" | ||
// RUN: %dafny /noVerify /compile:4 /compileTarget:cs "%s" >> "%t" | ||
// RUN: %dafny /noVerify /compile:4 /compileTarget:js "%s" >> "%t" | ||
// RUN: %dafny /noVerify /compile:4 /compileTarget:go "%s" >> "%t" | ||
// RUN: %dafny /noVerify /compile:4 /compileTarget:java "%s" >> "%t" | ||
// RUN: %dafny /noVerify /compile:4 /compileTarget:py "%s" >> "%t" | ||
// RUN: %diff "%s.expect" "%t" | ||
|
||
newtype sreal = r: real | r > -4 as real | ||
newtype sint = r: int | r > -4 as int | ||
newtype ssreal = r: sreal | r > -3 as sreal | ||
newtype ssint = r: sint | r > -3 as sint | ||
|
||
method Print(b: bool, end: string) | ||
// Print boolean `b` as `true` or `false`, then print `end`. This is needed | ||
// by C++ due to BUG(https://github.com/dafny-lang/dafny/issues/2773). | ||
{ | ||
if b { | ||
print "true"; | ||
} else { | ||
print "false"; | ||
} | ||
print end; | ||
} | ||
|
||
method Main() { | ||
Print(24 as real <= 1507 as real, " "); | ||
Print(24 as sreal <= 1507 as sreal, " "); | ||
Print(24 as ssreal <= 1507 as ssreal, " "); | ||
Print(24 as int <= 1507 as int, " "); | ||
Print(24 as sint <= 1507 as sint, " "); | ||
Print(24 as ssint <= 1507 as ssint, " "); | ||
Print(24 as bv16 <= 1507 as bv16, " "); | ||
Print(24 as bv232 <= 1507 as bv232, " "); | ||
Print(24 as char <= 1507 as char, " "); | ||
Print(24 as ORDINAL <= 1507 as ORDINAL, "\n"); | ||
|
||
Print(24 as real == 1507 as real, " "); | ||
Print(24 as sreal == 1507 as sreal, " "); | ||
Print(24 as ssreal == 1507 as ssreal, " "); | ||
Print(24 as int == 1507 as int, " "); | ||
Print(24 as sint == 1507 as sint, " "); | ||
Print(24 as ssint == 1507 as ssint, " "); | ||
Print(24 as bv16 == 1507 as bv16, " "); | ||
Print(24 as bv232 == 1507 as bv232, " "); | ||
Print(24 as char == 1507 as char, " "); | ||
Print(24 as ORDINAL == 1507 as ORDINAL, "\n"); | ||
|
||
Print(24 as real >= 1507 as real, " "); | ||
Print(24 as sreal >= 1507 as sreal, " "); | ||
Print(24 as ssreal >= 1507 as ssreal, " "); | ||
Print(24 as int >= 1507 as int, " "); | ||
Print(24 as sint >= 1507 as sint, " "); | ||
Print(24 as ssint >= 1507 as ssint, " "); | ||
Print(24 as bv16 >= 1507 as bv16, " "); | ||
Print(24 as bv232 >= 1507 as bv232, " "); | ||
Print(24 as char >= 1507 as char, " "); | ||
Print(24 as ORDINAL >= 1507 as ORDINAL, "\n"); | ||
|
||
Print(24 as real < 1507 as real, " "); | ||
Print(24 as sreal < 1507 as sreal, " "); | ||
Print(24 as ssreal < 1507 as ssreal, " "); | ||
Print(24 as int < 1507 as int, " "); | ||
Print(24 as sint < 1507 as sint, " "); | ||
Print(24 as ssint < 1507 as ssint, " "); | ||
Print(24 as bv16 < 1507 as bv16, " "); | ||
Print(24 as bv232 < 1507 as bv232, " "); | ||
Print(24 as char < 1507 as char, " "); | ||
Print(24 as ORDINAL < 1507 as ORDINAL, "\n"); | ||
|
||
Print(24 as real != 1507 as real, " "); | ||
Print(24 as sreal != 1507 as sreal, " "); | ||
Print(24 as ssreal != 1507 as ssreal, " "); | ||
Print(24 as int != 1507 as int, " "); | ||
Print(24 as sint != 1507 as sint, " "); | ||
Print(24 as ssint != 1507 as ssint, " "); | ||
Print(24 as bv16 != 1507 as bv16, " "); | ||
Print(24 as bv232 != 1507 as bv232, " "); | ||
Print(24 as char != 1507 as char, " "); | ||
Print(24 as ORDINAL != 1507 as ORDINAL, "\n"); | ||
|
||
Print(24 as real > 1507 as real, " "); | ||
Print(24 as sreal > 1507 as sreal, " "); | ||
Print(24 as ssreal > 1507 as ssreal, " "); | ||
Print(24 as int > 1507 as int, " "); | ||
Print(24 as sint > 1507 as sint, " "); | ||
Print(24 as ssint > 1507 as ssint, " "); | ||
Print(24 as bv16 > 1507 as bv16, " "); | ||
Print(24 as bv232 > 1507 as bv232, " "); | ||
Print(24 as char > 1507 as char, " "); | ||
Print(24 as ORDINAL > 1507 as ORDINAL, "\n"); | ||
|
||
Print(0 as bv0 <= 0 as bv0, " "); | ||
Print(0 as bv0 == 0 as bv0, " "); | ||
Print(0 as bv0 >= 0 as bv0, "\n"); | ||
|
||
Print(0 as bv0 < 0 as bv0, " "); | ||
Print(0 as bv0 != 0 as bv0, " "); | ||
Print(0 as bv0 > 0 as bv0, "\n"); | ||
} |
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,52 @@ | ||
|
||
Dafny program verifier finished with 5 verified, 0 errors | ||
|
||
Dafny program verifier did not attempt verification | ||
true true true true true true true true true true | ||
false false false false false false false false false false | ||
false false false false false false false false false false | ||
true true true true true true true true true true | ||
true true true true true true true true true true | ||
false false false false false false false false false false | ||
true true true | ||
false false false | ||
|
||
Dafny program verifier did not attempt verification | ||
true true true true true true true true true true | ||
false false false false false false false false false false | ||
false false false false false false false false false false | ||
true true true true true true true true true true | ||
true true true true true true true true true true | ||
false false false false false false false false false false | ||
true true true | ||
false false false | ||
|
||
Dafny program verifier did not attempt verification | ||
true true true true true true true true true true | ||
false false false false false false false false false false | ||
false false false false false false false false false false | ||
true true true true true true true true true true | ||
true true true true true true true true true true | ||
false false false false false false false false false false | ||
true true true | ||
false false false | ||
|
||
Dafny program verifier did not attempt verification | ||
true true true true true true true true true true | ||
false false false false false false false false false false | ||
false false false false false false false false false false | ||
true true true true true true true true true true | ||
true true true true true true true true true true | ||
false false false false false false false false false false | ||
true true true | ||
false false false | ||
|
||
Dafny program verifier did not attempt verification | ||
true true true true true true true true true true | ||
false false false false false false false false false false | ||
false false false false false false false false false false | ||
true true true true true true true true true true | ||
true true true true true true true true true true | ||
false false false false false false false false false false | ||
true true true | ||
false false false |