Punkte pro Testfall: 5; Abzug pro fehlerhaften Testfall: 0; Maximum: 25 Testfall: {-1,1-}writeLayer (Leaf 21) BottomUp == [[21]]; Testfall OK Testfall: {-1,2-}writeLayer (Node 11 (Leaf 21) (Leaf 22)) BottomUp == [[21,22],[11]]; Testfall OK Testfall: {-1,3-}writeLayer (Node 11(Leaf 21)(Node 22 (Leaf 31)(Leaf 32))) BottomUp ; Testfall FALSCH Erwartet: {-1,3-}writeLayer (Node 11(Leaf 21)(Node 22 (Leaf 31)(Leaf 32))) BottomUp == [[31,32],[21,22],[11]] Ausgabe: {-1,3-}writeLayer (Node 11(Leaf 21)(Node 22 (Leaf 31)(Leaf 32))) BottomUp ==[[21,31,32],[11]] Testfall: {-1,4-}writeLayer (Node 11(Leaf 21)(Node 22 (Leaf 31)(Leaf 32))) TopDown ; Testfall FALSCH Erwartet: {-1,4-}writeLayer (Node 11(Leaf 21)(Node 22 (Leaf 31)(Leaf 32))) TopDown == [[11],[21,22],[31,32]] Ausgabe: {-1,4-}writeLayer (Node 11(Leaf 21)(Node 22 (Leaf 31)(Leaf 32))) TopDown ==[[11],[21,22]] Testfall: {-1,5-}take 5 [(n::Integer,r,c)|n<-[1..6],c<-[[1..(2^(n+1)-1)]],r<-[let t 0 i=(Leaf i);t(m+1)i=Node i(t m(2*i))(t m(2*i+1));in concat(writeLayer(t n 1)TopDown)],r/=c]== []; Testfall OK Testfaelle OK: 3; Testfaelle FALSCH: 2 Punkte : 15 Punkte pro Testfall: 5; Abzug pro fehlerhaften Testfall: 0; Maximum: 25 Testfall: {-2,1-}transform (Leaf 27) == (SNode 27 Nil Nil); Testfall OK Testfall: {-2,1-}[1|(SNode 27 Nil Nil)<-[transform (Leaf 27)]] == [1]; Testfall OK Testfall: {-2,1'-}Nil == Nil; Testfall OK Testfall: {-2,2-}show (transform (Leaf 27)) == show (SNode 27 Nil Nil); Testfall OK Testfall: {-2,3-}let r=[0..1];f p=[Leaf i|i<-r]++[(Node i l r)|i<-r,l<-p,r<-p];g Nil=[];g(SNode i l r)=g(l)++[i]++g(r)in take 5[u|t<-(f.f.f)[],u<-[(g.transform)t],u/=[0],u/=[1],u/=[0,1]] == []; Testfall OK Testfall: {-2,4-}take 5[(n::Integer,r,c)|n<-[1..9],r<-[let t 0=(Leaf 0);t(m+1)=Node m(t m)(t m);fl(Nil)=[];fl(SNode x l r)=fl(l)++[x]++fl(r)in (fl.transform)((t n))],c<-[[0..(n-1)]],c/=r] == []; Testfall OK Testfall: {-2,5-}take 5[(n::Integer,r,c)|n<-[1..7],r<-[let t 0 i=(Leaf i);t(m+1)i=Node i(t m(2*i))(t m(2*i+1));fl(Nil)=[];fl(SNode x l r)=fl(l)++[x]++fl(r)in (fl.transform)((t n 1))],c<-[[1..(2^(n+1))-1]],c/=r] == []; Testfall OK Testfaelle OK: 7; Testfaelle FALSCH: 0 Punkte : 25 Punkte pro Testfall: 5; Abzug pro fehlerhaften Testfall: 0; Maximum: 25 Testfall: {-3,1-}(path(Graph[(1,[(2,1)])])9 2 1) == Invalid; Testfall OK Testfall: {-3,1'-}[1|Invalid<-[path(Graph[(1,[(2,1)])])9 2 1]] == [1]; Testfall OK Testfall: {-3,2-}[k|k<-[1..9],path(Graph[(1,[(2,1)])])1 2 k/=Yes] ; Testfall FALSCH Erwartet: {-3,2-}[k|k<-[1..9],path(Graph[(1,[(2,1)])])1 2 k/=Yes] == [] Ausgabe: {-3,2-}[k|k<-[1..9],path(Graph[(1,[(2,1)])])1 2 k/=Yes] ==[1,2,3,4,5,6,7,8,9] Testfall: {-3,2'-}let ny Yes=False;ny _=True in[k|k<-[1..9],ny(path(Graph[(1,[(2,1)])])1 2 k)] ; Testfall FALSCH Erwartet: {-3,2'-}let ny Yes=False;ny _=True in[k|k<-[1..9],ny(path(Graph[(1,[(2,1)])])1 2 k)] == [] Ausgabe: {-3,2'-}let ny Yes=False;ny _=True in[k|k<-[1..9],ny(path(Graph[(1,[(2,1)])])1 2 k)] ==[1,2,3,4,5,6,7,8,9] Testfall: {-3,3-}let nn No=False;nn _ =True;m=10;r=[1..m];g=Graph[(i,[(j,1)|j<-r,(j`mod`3)>(i`mod`3)])|i<-r]in[i|i<-r,nn(path g 1 i m)] ; Testfall FALSCH Erwartet: {-3,3-}let nn No=False;nn _ =True;m=10;r=[1..m];g=Graph[(i,[(j,1)|j<-r,(j`mod`3)>(i`mod`3)])|i<-r]in[i|i<-r,nn(path g 1 i m)] == [2,5,8] Ausgabe: {-3,3-}let nn No=False;nn _ =True;m=10;r=[1..m];g=Graph[(i,[(j,1)|j<-r,(j`mod`3)>(i`mod`3)])|i<-r]in[i|i<-r,nn(path g 1 i m)] ==[1,2,3,4,5,6,7,8,9,10] Testfall: {-3,3'-}let nn No=False;nn _ =True;m=10;r=[1..m];g=Graph[(i,[(j,1)|j<-r,(j`mod`3)>(i`mod`3)])|i<-r]in[i|i<-r,nn(path g 1 i m)] ; Testfall FALSCH Erwartet: {-3,3'-}let nn No=False;nn _ =True;m=10;r=[1..m];g=Graph[(i,[(j,1)|j<-r,(j`mod`3)>(i`mod`3)])|i<-r]in[i|i<-r,nn(path g 1 i m)] == [1,2,5,8] Ausgabe: {-3,3'-}let nn No=False;nn _ =True;m=10;r=[1..m];g=Graph[(i,[(j,1)|j<-r,(j`mod`3)>(i`mod`3)])|i<-r]in[i|i<-r,nn(path g 1 i m)] ==[1,2,3,4,5,6,7,8,9,10] Testfall: {-3,4-}let ny Yes=False;ny _=True in[n|n<-[1..15],ny(path(Graph[(i,[(i+1,1)])|i<-[1..n]])1 n(n-1))] ; Testfall FALSCH Erwartet: {-3,4-}let ny Yes=False;ny _=True in[n|n<-[1..15],ny(path(Graph[(i,[(i+1,1)])|i<-[1..n]])1 n(n-1))] == [] Ausgabe: {-3,4-}let ny Yes=False;ny _=True in[n|n<-[1..15],ny(path(Graph[(i,[(i+1,1)])|i<-[1..n]])1 n(n-1))] ==[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] Testfall: {-3,5-}let ny Yes=False;ny _=True in[n|n<-[1..15],ny(path(Graph[(i,[(j,j-i)|j<-[i+1..n]])|i<-[1..n]])1 n (n-1))] ; Testfall FALSCH Erwartet: {-3,5-}let ny Yes=False;ny _=True in[n|n<-[1..15],ny(path(Graph[(i,[(j,j-i)|j<-[i+1..n]])|i<-[1..n]])1 n (n-1))] == [] Ausgabe: {-3,5-}let ny Yes=False;ny _=True in[n|n<-[1..15],ny(path(Graph[(i,[(j,j-i)|j<-[i+1..n]])|i<-[1..n]])1 n (n-1))] ==[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] Testfall: {-3,5'-}let nn No=False;nn _ =True in[n|n<-[15],nn(path(Graph[(i,[(i+1,1)])|i<-[1..n]])1 n(n-2))] ; Testfall FALSCH Erwartet: {-3,5'-}let nn No=False;nn _ =True in[n|n<-[15],nn(path(Graph[(i,[(i+1,1)])|i<-[1..n]])1 n(n-2))] == [] Ausgabe: {-3,5'-}let nn No=False;nn _ =True in[n|n<-[15],nn(path(Graph[(i,[(i+1,1)])|i<-[1..n]])1 n(n-2))] ==[15] Testfaelle OK: 2; Testfaelle FALSCH: 7 Punkte : 10 Punkte pro Testfall: 5; Abzug pro fehlerhaften Testfall: 0; Maximum: 25 Testfall: {-4,1-}minpath (Graph[(1,[(2,1)])])1 2 ; Testfall FALSCH Erwartet: {-4,1-}minpath (Graph[(1,[(2,1)])])1 2 == ([1,2],1) Ausgabe: {-4,1-}minpath (Graph[(1,[(2,1)])])1 2 ==ERROR - Undefined variable "minpath" Testfall: {-4,2-}let m=5;r=[1..m];g=Graph[(i,[(j,1)|j<-r,i/=j,(j`mod`3)>=(i`mod`3)])|i<-r]in take 11[c|i<-r,j<-r,i/=j,(_,c)<-[minpath g i j]] ; Testfall FALSCH Erwartet: {-4,2-}let m=5;r=[1..m];g=Graph[(i,[(j,1)|j<-r,i/=j,(j`mod`3)>=(i`mod`3)])|i<-r]in take 11[c|i<-r,j<-r,i/=j,(_,c)<-[minpath g i j]] == [1,0,1,1,0,0,0,1,1,1,1] Ausgabe: {-4,2-}let m=5;r=[1..m];g=Graph[(i,[(j,1)|j<-r,i/=j,(j`mod`3)>=(i`mod`3)])|i<-r]in take 11[c|i<-r,j<-r,i/=j,(_,c)<-[minpath g i j]] ==ERROR - Undefined variable "minpath" Testfall: {-4,3-}let m=4;r=[1..m];g=Graph[(i,[(j,1)|j<-r,i/=j,(j`mod`3)/=(i`mod`3)])|i<-r]in take 9 ([c|i<-r,j<-r,i/=j,(_,c)<-[minpath g i j]]) ; Testfall FALSCH Erwartet: {-4,3-}let m=4;r=[1..m];g=Graph[(i,[(j,1)|j<-r,i/=j,(j`mod`3)/=(i`mod`3)])|i<-r]in take 9 ([c|i<-r,j<-r,i/=j,(_,c)<-[minpath g i j]]) == [1,1,2,1,1,1,1,1,1] Ausgabe: {-4,3-}let m=4;r=[1..m];g=Graph[(i,[(j,1)|j<-r,i/=j,(j`mod`3)/=(i`mod`3)])|i<-r]in take 9 ([c|i<-r,j<-r,i/=j,(_,c)<-[minpath g i j]]) ==ERROR - Undefined variable "minpath" Testfall: {-4,4-}let m=5;r=[1..m];g=Graph[(i,[(j,1)|j<-r,i/=j,(j`mod`3)/=(i`mod`3)])|i<-r]in take 11([c|i<-r,j<-r,i/=j,(_,c)<-[minpath g i j]]) ; Testfall FALSCH Erwartet: {-4,4-}let m=5;r=[1..m];g=Graph[(i,[(j,1)|j<-r,i/=j,(j`mod`3)/=(i`mod`3)])|i<-r]in take 11([c|i<-r,j<-r,i/=j,(_,c)<-[minpath g i j]]) == [1,1,2,1,1,1,1,2,1,1,1] Ausgabe: {-4,4-}let m=5;r=[1..m];g=Graph[(i,[(j,1)|j<-r,i/=j,(j`mod`3)/=(i`mod`3)])|i<-r]in take 11([c|i<-r,j<-r,i/=j,(_,c)<-[minpath g i j]]) ==ERROR - Undefined variable "minpath" Testfall: {-4,5'-}let m=6;r=[1..m];g=Graph[(i,[(j,1)|j<-r,i/=j,(j`mod`3)/=(i`mod`3)])|i<-r]in take 11([c|i<-r,j<-r,i/=j,(_,c)<-[minpath g i j]]) ; Testfall FALSCH Erwartet: {-4,5'-}let m=6;r=[1..m];g=Graph[(i,[(j,1)|j<-r,i/=j,(j`mod`3)/=(i`mod`3)])|i<-r]in take 11([c|i<-r,j<-r,i/=j,(_,c)<-[minpath g i j]]) == [1,1,2,1,1,1,1,1,2,1,1] Ausgabe: {-4,5'-}let m=6;r=[1..m];g=Graph[(i,[(j,1)|j<-r,i/=j,(j`mod`3)/=(i`mod`3)])|i<-r]in take 11([c|i<-r,j<-r,i/=j,(_,c)<-[minpath g i j]]) ==ERROR - Undefined variable "minpath" Testfaelle OK: 0; Testfaelle FALSCH: 5 Punkte : 0 Punkte gesamt: 50