bro
This commit is contained in:
1 parent
de41a02749
commit
9af09cebd3
764 files changed
+54218
-78859
No files matched your search
@@ -0,0 +1,28 @@
|
||||
from undo_doodle import start_stroke, extend_stroke, push_history, undo, MAX_HISTORY
|
||||
|
||||
|
||||
def test_strich_erzeugt_neuen_zustand():
|
||||
s0 = []
|
||||
s1 = start_stroke(s0, (1, 1))
|
||||
s2 = extend_stroke(s1, (2, 2))
|
||||
|
||||
assert s0 == [] # alter Zustand unverändert
|
||||
assert s1 == [[(1, 1)]] # s1 auch unverändert nach extend
|
||||
assert s2 == [[(1, 1), (2, 2)]]
|
||||
|
||||
|
||||
def test_undo_stellt_vorzustand_wieder_her():
|
||||
s0 = []
|
||||
history = push_history([], s0)
|
||||
s1 = start_stroke(s0, (1, 1))
|
||||
|
||||
state, history = undo(s1, history)
|
||||
assert state == []
|
||||
assert history == []
|
||||
|
||||
|
||||
def test_historie_ist_begrenzt():
|
||||
history = []
|
||||
for i in range(10):
|
||||
history = push_history(history, [i])
|
||||
assert len(history) == MAX_HISTORY
|
||||
Reference in new issue
Block a user