-
Notifications
You must be signed in to change notification settings - Fork 19
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
f11e76c
commit 3ba5b45
Showing
3 changed files
with
84 additions
and
82 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 |
---|---|---|
@@ -1,27 +1,23 @@ | ||
#include <owi.h> | ||
|
||
/* | ||
extern "C" { | ||
void _start() { | ||
owi_abort(); | ||
} | ||
} | ||
*/ | ||
|
||
class Poly { | ||
public: | ||
int poly; | ||
Poly(int a, int b, int c, int d) { | ||
int x = owi_i32(); | ||
int x2 = x * x; | ||
int x3 = x * x * x; | ||
poly = a * x3 + b * x2 + c * x + d; | ||
} | ||
int getPoly() { | ||
return this->poly; | ||
} | ||
}; | ||
|
||
int main() { | ||
int x = owi_i32(); | ||
int x2 = x * x; | ||
int x3 = x * x * x; | ||
|
||
int a = 1; | ||
int b = -7; | ||
int c = 14; | ||
int d = -8; | ||
|
||
int poly = a * x3 + b * x2 + c * x + d; | ||
Poly p(1, -7, 14, -8); | ||
|
||
owi_assert(poly != 0); | ||
owi_assert(p.getPoly() != 0); | ||
|
||
return 0; | ||
} |
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 |
---|---|---|
@@ -1,25 +1,28 @@ | ||
#include <owi.h> | ||
|
||
int main() { | ||
int x = owi_i32(); | ||
int x2 = x * x; | ||
int x3 = x * x * x; | ||
|
||
int a = 1; | ||
int b = -7; | ||
int c = 14; | ||
int d = -8; | ||
|
||
int poly = a * x3 + b * x2 + c * x + d; | ||
class Poly { | ||
public: | ||
int poly; | ||
Poly(int a, int b, int c, int d) { | ||
int x = owi_i32(); | ||
int x2 = x * x; | ||
int x3 = x * x * x; | ||
poly = a * x3 + b * x2 + c * x + d; | ||
owi_assume(x != 1); | ||
owi_assume(x != 2); | ||
// Make model output deterministic | ||
owi_assume(x > -2147483646); | ||
owi_assume(x != 4); | ||
} | ||
int getPoly() { | ||
return this->poly; | ||
} | ||
}; | ||
|
||
owi_assume(x != 1); | ||
owi_assume(x != 2); | ||
owi_assume(x != 4); | ||
|
||
// Make model output deterministic | ||
owi_assume(x > -2147483646); | ||
int main() { | ||
Poly p(1, -7, 14, -8); | ||
|
||
owi_assert(poly != 0); | ||
owi_assert(p.getPoly() != 0); | ||
|
||
return 0; | ||
} |