Skip to content

Instantly share code, notes, and snippets.

@benjjo
Last active December 19, 2020 20:16
Show Gist options
  • Save benjjo/5b18537321d54391c59859b3be3ffa57 to your computer and use it in GitHub Desktop.
Save benjjo/5b18537321d54391c59859b3be3ffa57 to your computer and use it in GitHub Desktop.
Simple test fnction
failed = 0
ran = 0
def test(name, actual, expected):
"""Report if test passed or failed."""
global ran, failed
if actual == expected:
print(name, 'OK')
else:
print(name, 'FAILED: got', actual, 'instead of', expected)
failed += 1
ran += 1
test('Running a simple test; expect 0.', functionToTest(args), 0)
print('================================================')
print('All tests run:', ran - failed, 'OK,', failed, 'FAILED')
print('================================================')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment