Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created October 3, 2019 09:04
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 jasongorman/f22ebea05994d6087d42a0f958097ee0 to your computer and use it in GitHub Desktop.
Save jasongorman/f22ebea05994d6087d42a0f958097ee0 to your computer and use it in GitHub Desktop.
from assertion import assert_equals
from assertion import assert_raises
from maths import sqrt
def run():
print('Running sqrt tests...')
assert_equals('sqrt of 0.0', 0.0, sqrt(0.0))
assert_equals('sqrt of 1.0', 1.0, sqrt(1.0))
assert_equals('sqrt of 4.0', 2.0, sqrt(4.0))
assert_equals('sqrt of 6.25', 2.5, sqrt(6.25))
assert_raises("sqrt of -1.0", Exception, lambda: sqrt(-1.0))
if __name__ == '__main__':
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment