-
-
Save Groogy/0b952d2d279b740fdbcb to your computer and use it in GitHub Desktop.
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
class Foobar | |
{ | |
public: | |
Foobar(float val) { myVal = val; } | |
float func1(float x) | |
{ | |
REQUIRES(x > 0); | |
return sqrt(myVal + x); | |
} | |
float func2(float x) | |
{ | |
REQUIRES(x != myVal); | |
ENSURES(x > 0); | |
return myVal + x; | |
} | |
private: | |
BEGIN_INVARIANT(Foobar) | |
INVARIANT(self.myVal > 0) | |
END_INVARIANT() | |
float myVal; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment