summaryrefslogtreecommitdiff
path: root/testing/code/test_gcd.py
blob: d1ee7dfcd4addd52d4695cfcaf107bda7ea9519d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from gcd import gcd, atoi

def test_gcd():
    assert gcd(48, 64) == 16
    assert gcd(44, 19) == 1

def test_atoi_works():
    x = '1'
    assert atoi(x) == 1

import pytest

def test_atoi_raises_error():
    x = 'hello'
    with pytest.raises(ValueError):
        atoi(x)


if __name__ == '__main__':
    test_gcd()