CS2613/tests/practice/Q3/test_practice_questions.py
2022-11-23 10:09:24 -04:00

38 lines
847 B
Python

from practice_questions import is_word
def test_match():
assert is_word("akataka") == True
assert is_word("ububu") == True
assert is_word("ikekezaza") == True
def test_extra():
assert is_word("akatakaa") == False
assert is_word("uububu") == False
def test_bad_letter():
assert is_word("yakataka") == False
assert is_word("akatakala") == False
def test_consonant_start():
assert is_word("kakataka") == False
assert is_word("bububu") == False
from practice_questions import cycle
def test_small():
lst = [1,2,3]
g = cycle(lst)
assert next(g) == lst
assert next(g) == [2,3,1]
assert next(g) == [3,1,2]
def test_big():
n = 5000
lst = list(range(n))
g = cycle(lst)
for j in range(n):
lst2 = next(g)
assert lst2[0] == n-1
lst3 = next(g)
assert lst3==lst