Skip to content

Instantly share code, notes, and snippets.

@ileacristian
Created October 11, 2011 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ileacristian/1279427 to your computer and use it in GitHub Desktop.
Save ileacristian/1279427 to your computer and use it in GitHub Desktop.
python snippet
def test_gcd():
assert gcd(0, 2) == 2
assert gcd(2, 0) == 2
assert gcd(2, 3) == 1
assert gcd(2, 4) == 2
assert gcd(6, 4) == 2
assert gcd(24, 9) == 3
try:
gcd(-2, 0)
gcd(0, -2)
gcd(0, 0)
assert False # linia A
except ValueError:
assert True # linia B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment