Created
March 11, 2013 02:20
-
-
Save jbranchaud/5131506 to your computer and use it in GitHub Desktop.
Exercise 4 from Microsoft's Dafny on Rise4Fun.com
This file contains hidden or 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
/* | |
* Write a function max that returns the larger of two given | |
* integer parameters. Write a test method using an assert that | |
* checks that your function is correct. | |
*/ | |
function max(a: int, b: int): int | |
{ | |
if a > b then a else b | |
} | |
method Testing() { | |
assert max(10,12) == 12; | |
assert max(12,10) == 12; | |
assert max(10,10) == 10; | |
assert max(-10,0) == 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment