1 -- Testfaelle Aufgabenblatt 5
3 testall = and [testinp, testkonv, testfkt]
6 tinp_all = [tinp_1, tinp_2, tinp_3, tinp_4]
8 tinp_1 = (4,[(1,2,500), (0,3,100), (0,2,200)]) -- okay
9 tinp_2 = (2,xs) -- zu viele Kanten
11 tinp_3 = (maxno,(2,1,400):xs) -- zwei Kanten zwischen zwei Knoten
12 where (maxno,xs) = tinp_1
13 tinp_4 = (maxno,(1,3,-400):xs) -- negative Kosten
14 where (maxno,xs) = tinp_1
16 testinp = [True,False,True,False] == [isValid x | x <- tinp_all]
18 -- 2.: Beachten Sie, dass das Resultat i.a. nicht eindeutig festgelegt ist!
19 tkonv_all = [tkonv_a, tkonv_b, tkonv_c, tkonv_d, tkonv_e, tkonv_f, tkonv_g]
21 tkonv_a = inp2el tinp_1 == (ELg 4 [(1,500,2),(0,100,3),(0,200,2)])
22 tkonv_b = al2am (el2al (inp2el tinp_1)) == (AMg [[0,0,200,100,0],[0,0,500,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]])
23 tkonv_c = al2el (el2al (inp2el tinp_1)) == (ELg 4 [(0,100,3),(0,200,2),(1,500,2)] )
24 tkonv_d = am2al (el2am (inp2el tinp_1)) == (ALg [(0,[(2,200),(3,100)]),(1,[(2,500)]),(2,[]),(3,[]),(4,[])])
25 tkonv_e = am2el (el2am (inp2el tinp_1)) == (ELg 4 [(0,200,2),(0,100,3),(1,500,2)])
26 tkonv_f = el2al (inp2el tinp_1) == (ALg [(0,[(3,100),(2,200)]),(1,[(2,500)]),(2,[]),(3,[]),(4,[])])
27 tkonv_g = el2am (inp2el tinp_1) == (AMg [[0,0,200,100,0],[0,0,500,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]])
29 testkonv = and tkonv_all
32 tfkt_all = [tfkt_a,tfkt_b,tfkt_c,tfkt_d,tfkt_e,tfkt_f]
34 tfkt_a = isNeighbourOf (inp2el tinp_1) 0 2 == True
35 tfkt_b = allNeighboursOf (inp2el tinp_1) 0 == [2,3]
36 tfkt_c = numberOfEdges (el2am (inp2el tinp_1)) == 3
37 gcycle = ALg [(0,[]), (1,[(2,20)]), (2,[(3,30),(5,50)]), (3,[(0,500),(4,40)]), (4,[(1,10)])]
38 tfkt_d = isOnCycle gcycle 1 200 == True
39 tfkt_e = isOnCycle gcycle 2 50 == False
40 tfkt_f = isOnCycle gcycle 5 1000 == False
42 testfkt = and tfkt_all