9 . /cs/www/classes/cs372/spring16/a9/tests /cs/www/classes/cs372/spring16/a9/master #TODO: append, middle, posints problem append append.pl build a9/checkpl append.pl test head template ulimit -t 2; echo "findall(R, , Results)." | ./a.out 2>&1 | ruby a9/fg.rb case head([a,b,c],R) case head(R,end) case head([a,b,c],x) test last template ulimit -t 2; echo "findall(R, , Results)." | ./a.out 2>&1 | ruby a9/fg.rb case last([a,b,c],R) case last([a,b,c],b) case (length(R,4),last(R,end)) test init template ulimit -t 2; echo "findall(R, , Results)." | ./a.out 2>&1 | ruby a9/fg.rb case init([a,b,c,d],R) case init([a],R) case init([],R) test tail template ulimit -t 2; echo "findall(R, , Results)." | ./a.out 2>&1 | ruby a9/fg.rb case tail([a,b,c],R) case tail([a],R) case tail([],R) test min2 template ulimit -t 2; echo "findall(R, , Results)." | ./a.out 2>&1 | ruby a9/fg.rb case min2([0]) case min2([1]) case min2([1,2]) case min2([a,b,c,d]) test mem template ulimit -t 2; echo "findall(R, , Results)." | ./a.out 2>&1 | ruby a9/fg.rb case mem(2,[1,2,3]) case mem(4,[1,2,3]) case mem(R,[a,b,c,d,e,f,g]) test contains # # Following case has fail to keep Lists from being output. case ulimit -t 2; echo "findall(L,(contains([1,2,3,4],L),L\==[]),Lists),msort(Lists,Sorted),writeln(Sorted),fail." | ./a.out case ulimit -t 2; echo "findall(true,contains([1,2,3,4,5],[2,3,4]),R)." | ./a.out case ulimit -t 2; echo "findall(true,contains([1,2,3,4,5],[2,3,4,5]),R)." | ./a.out case ulimit -t 2; echo "findall(true,contains([1,2,3,4,5],[1,2,3,4,5]),R)." | ./a.out case ulimit -t 2; echo "findall(true,contains([1,2,3,4,5],[1,2,35]),R)." | ./a.out case ulimit -t 2; echo "findall(true,contains([1,2,3,4,5],[2,35]),R)." | ./a.out case ulimit -t 2; echo "findall(true,contains([1,2,3,4,5],[4,5,6]),R)." | ./a.out test firstlast template ulimit -t 2; echo "findall(R, , Results)." | ./a.out 2>&1 | ruby a9/fg.rb case (length(R,7),firstlast(R,[first,last])) case firstlast([a,b,c,d,e,f,g],R) case firstlast([one],R) case firstlast([],R) case test halves template ulimit -t 2; echo "findall(R, , Results)." | ./a.out 2>&1 | ruby a9/fg.rb case (halves([a,b,c,d,e,f,g],A,B),R=result(A,B)) case (halves([a,b,c,d,e,f,g,h],A,B),R=result(A,B)) case (halves([a,b],A,B),R=result(A,B)) case (halves([],A,B),R=result(A,B)) problem middle middle.pl build a9/checkpl middle.pl test middle template ulimit -t 2; echo "findall(M, , Results)." | ./a.out 2>&1 | ruby a9/fg.rb case middle([a,b,c,d,e],3,M) case middle([a,b,c,d,e],5,M) case middle([a,b,c,d,e],2,M) case middle([a,b,c,d,e,f],2,M) case middle([a,b,c],1,M) case middle([a,b,c],2,M) # # problem splits splits.pl build a9/checkpl splits.pl test splits template ulimit -t 2; echo "findall(R, splits(,R),Results)." | ./a.out case [1,2,3] case [] case [1,2] case [a,b,c,d] case ['//', ',', '[1]/[2]', '[1,2,3/4]'] case [a+b,a*c,1+2/3,[1,2,3]] # problem posints posints.pl build a9/checkpl posints.pl test posints template ulimit -t 2; echo "findall(true, , Results)." | ./a.out 2>&1 | ruby a9/fg.rb case posints([1,2,3,4,5]) case posints([1,2,3,-4,5]) case posints([1,xyz,3,4,5]) case posints([]) # problem repl repl.pl build a9/checkpl repl.pl test repl template ulimit -t 2; echo "" | ./a.out case once(repl(x,5,L)). case once(repl(1,3,[1,1,1])). case once(repl(1,3,[1,1,2])). case once((repl(X,2,L), X=7, repl(L,5,L5))). case once((repl(X,2,L), X=7, repl(L,5,L5), repl(L5, 1000,LMM), flatten(LMM,F), length(F,Len))). case once(repl(a,0,X)). case once(repl(a,-1,X)). # # problem pick pick.pl build a9/checkpl pick.pl test pick template ulimit -t 2; echo "findall(S,,Results)." | ./a.out case pick('testing', [0,6], S) case pick('testing', [1,1,1], S) case pick('testing', [10,2,4], S) case (between(0,6,P), P2 is P+1, pick('testing', [P,P2], S), writeln(S), fail) case pick('testing', [], S) case pick('abcdefghijklmnopqrstuvwxyz0123456789', [13,29,22,5,44,43,12,46,17,40,37,2,39,2,2,2,2,7,15,42,18,41,35,4,3,4,3,4,3,4,33,36,34,31,48,9,19,1,47,27,50,10,28,8,26,25,38,23,49,45,6,30,3,32,4,14,20,24,16,21,11],S) # # problem polyperim polyperim.pl build a9/checkpl polyperim.pl test polyperim template ulimit -t 2; echo 'findall(Perim,polyperim(,Perim),Perims).' | ./a.out case [pt(0,0),pt(3,4),pt(0,4),pt(0,0)] case [pt(3,4),pt(0,4),pt(0,0),pt(3,4)] case [pt(0,0),pt(0,1),pt(1,1),pt(1,0),pt(0,0)] case [pt(0,0),pt(1,1),pt(0,1),pt(1,0),pt(0,0)] case [pt(0,0),pt(3,4),pt(0,4)] case [pt(0,0),pt(0,4)] case [pt(0,0)] case [pt(0,0),pt(1,1),pt(0,1),pt(1,0),pt(0,1)] # # problem switched switched.pl build a9/checkpl switched.pl test switched template ulimit -t 2; echo 'switched().' | ./a.out 2>&1 | sed '/^$/d' | sed 's/ *$//' case 51,58 case 54,59 case 56,57 case 53,57 case 54,55 # # problem iz iz.pl build a9/checkpl iz.pl test iz1 template ulimit -t 2; echo "findall(R,,Results)." | ./a.out case R iz space case R iz dollar case R iz comma case R iz dot case R iz test test iz2 #template ulimit -t 2; echo "findall(R,(()),Results)." | ./a.out template ulimit -t 2; echo "once(())." | ./a.out case E = abc+def, R iz E case E = abc*6, R iz E case E = abc*(2+3-1), R iz E case E = '123456789'/2, R iz E case E = '123456789'/(-3), R iz E case E = len(abc+def), R iz E case E = len(abc)+len(def), R iz E case E = len(len(len)), R iz E case E = wrap(abc,len('*'*2),len('<'*3)), R iz E case E = wrap(abc,x), R iz E case E = wrap(dot,x), R iz E case E = wrap(dot * 3, '='), R iz E case E = wrap(dot * 3, '>','<'), R iz E case X = 'ab', Y = 'cde', Z = 'zz', E = wrap(-(X+Y*4)/6+xyz, 'Start>','<'+(end*3+Z*2)), R iz E case X = 'ab', Y = 'cde', Z = 'zz', E = len(wrap(-(X+Y*4)/6+xyz, 'Start>','<'+(end*3+Z*2))), R iz E case E = wrap(zero/0,x), R iz E case E = abc+xyz, R iz E case E = (ab + cd)*2, R iz E case E = -cat*3, R iz E case E = abcde / 2, R iz E case E = abcde / -3, R iz E case E = wrap(aaa,'X'), R iz E case E = wrap(abc,'*'*2,'<'*3), R iz E case E = -(wrap(abc,'*.'*2,'<'*3)/2), R iz E case E = -(wrap(abc,'*.'*2,len('<'*3))), R iz E case N = 5, M = 3, X = 'ab', Y = 'cde', Z = 'zz', E1 = wrap(-(X+Y*4)/6+xyz,'Start>','<'+(end*3+Z*2)), E = wrap(wrap(-E1, E1*(N+1),-E1*(M+1)),'...'*3), R iz E case X iz wrap(-(ab+cde*4)/6+xyz,'Start>','<'+(end*3+zz*2)) case X iz a+b+(c+(de+fg)+hij+k)+l case X iz pi + e*3 case X = 2, Y= 3, S iz 'ab' * (X+Y*3) case S = '0123456789', R iz S + -S, End iz R / -(2+3) case X iz abc+(-abc)