def test_donkey_boundry(self): ## check if donkey doesnt crosses boundry a=[[0 for x in range(80)] for x in range (31)] h=Board() h.structure(a) h=Donkey(4,3) count=0 for i in range (1000): ## move donkey 100 times h.move_donkey(a) assert (a[4][79]!='D')
def test_donkey_number(self): ## check if number of donkeys increase due to bugs a=[[0 for x in range(80)] for x in range (31)] h=Board() h.structure(a) h=Donkey(4,3) count=0 for i in range (100): ## move donkey 100 times h.move_donkey(a) for i in range (80): if a[4][i]=='D': count=count+1 assert (count==1)
def test_donkey_presence(self): ## check how donkey behaves after 100 moves a=[[0 for x in range(80)] for x in range (31)] h=Board() h.structure(a) h=Donkey(4,3) flag=0 for i in range (100): ## move donkey 100 times h.move_donkey(a) for i in range (80): if a[4][i]=='D': flag=flag+1 assert (flag==1) ## flag = 1 means there is 1 donkey , and at level 4