-- Testfaelle zu Aufgabenblatt 7 testall = and [b1_t1, b1_t2, b2_t1, b2_t2, b3_t1, b3_t2, b4_t1, b4_t2, b4_t3] b1_a1 = (AMg [(["de","a","c","b"]),(["de","a","c","b"]),(["de","a","c",""]),(["de","a","","b"])]) -- alle woerter ueber {a,b,c,d,e}*, die weder bc noch cb enthalten, und nicht mit einem "a" enden -- zustand 0 "keine gefahr" -- zustand 1 "a ist am ende" -- zustand 2 "Gefahr, cb zu generieren" -- zustand 3 "Gefahr, bc zu generieren" -- start: 0 -- end: 0,2,3 b1_t1 = isPostfix b1_a1 0 [0,2,3] "ab" == True b1_t2 = isPostfix b1_a1 0 [0,2,3] "aba" == False -- Beachten Sie, dass das Resultat i.a. nicht eindeutig festgelegt ist b2_t1 = givePrefix b1_a1 0 [0,2,3] "ab" == (Just "a") b2_t2 = givePrefix b1_a1 0 [0,2,3] "aba" == Nothing b3_g1 = (ALbg [(0,5,[0..3]), (1,4,[0..3]), (2,333,[]), (3,2,[])]) b3_t1 = traverse ((flip (-)) 1) odd b3_g1 == ALbg [(0,4,[0,1,2,3]),(1,4,[0,1,2,3]),(2,332,[]),(3,2,[])] b3_t2 = (traverse ((*) 3) ((/=) 0 . (flip mod) 3) b3_g1) == ALbg [(0,15,[0,1,2,3]),(1,12,[0,1,2,3]),(2,333,[]),(3,6,[])] b4_g1 = (Ug [(0,Red,[1..3]), (1,Blue,[0,2,3]), (2,Green,[]), (3,Yellow,[])]) b4_g2 = (Ug [(0,Red,[1..3]), (1,Blue,[0,2,3]), (2,Yellow,[]), (3,Yellow,[])]) b4_g3 = (Ug [(0,Blue,[1..3]), (1,Blue,[0,2,3]), (2,Yellow,[]), (3,Yellow,[])]) b4_t1 = isWellColored b4_g1 == True b4_t2 = isWellColored b4_g2 == True b4_t3 = isWellColored b4_g3 == False