-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_fizbuz.py
33 lines (24 loc) · 1.21 KB
/
test_fizbuz.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from fizbuz import generate_fizbuz_answers, get_fizbuz, get_extended_fizbuz, FizzBuzzResult, compile_result
def test_fizbuz_solution():
result = generate_fizbuz_answers(100)
assert len(result) == 100
def test_get_fizbuz():
assert get_fizbuz(3) == FizzBuzzResult(fizz=1, buzz=0)
assert get_fizbuz(5) == FizzBuzzResult(fizz=0, buzz=1)
assert get_fizbuz(1) == FizzBuzzResult(fizz=0, buzz=0)
assert get_fizbuz(10) == FizzBuzzResult(fizz=0, buzz=1)
assert get_fizbuz(15) == FizzBuzzResult(fizz=1, buzz=1)
assert get_fizbuz(9) == FizzBuzzResult(fizz=1, buzz=0)
assert get_fizbuz(49) == FizzBuzzResult(fizz=0, buzz=0)
def test_get_extended_fizbuz():
assert get_extended_fizbuz(53) == FizzBuzzResult(fizz=1, buzz=1)
assert get_extended_fizbuz(49) == FizzBuzzResult(fizz=0, buzz=0)
assert get_extended_fizbuz(3) == FizzBuzzResult(fizz=1, buzz=0)
assert get_extended_fizbuz(55) == FizzBuzzResult(fizz=0, buzz=1)
def test_compile_result():
assert compile_result(49) == '49'
assert compile_result(9) == 'Fizz'
assert compile_result(3) == 'FizzFizz'
assert compile_result(32) == 'Fizz'
assert compile_result(52) == 'Buzz'
assert compile_result(35) == 'FizzBuzzBuzz'