



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Professor: Leavens; Class: Programming Languages I; Subject: Computer Programming; University: University of Central Florida; Term: Spring 2009;
Typology: Assignments
1 / 5
This page cannot be seen from the preview
Don't miss anything!




Regular Problems
Comparisons Among Models
Programming
% $Id: GenerateTripleTest.oz,v 1.2 2008/11/25 23:16:35 leavens Exp leavens $ \insert ’GenerateTriple.oz’ \insert ’SolveAll.oz’ \insert ’TestingNoStop.oz’ {StartTesting ’GenerateTriple forwards’} {Test {SolveAll proc {$ X} {GenerateTriple 1 X} end } ’==’ [1#1#1]} {Test {SolveAll proc {$ X} {GenerateTriple 2 X} end } ’==’ [1#1#2 1#2#2 2#2#2]} {Test {SolveAll proc {$ X} {GenerateTriple 3 X} end } ’==’ [1#1#3 1#2#3 2#2#3 1#3#3 2#3#3 3#3#3]} {Test {SolveAll proc {$ X} {GenerateTriple 8 X} end } ’==’ [1#1# 1#2#8 2#2# 1#3#8 2#3#8 3#3# 1#4#8 2#4#8 3#4#8 4#4# 1#5#8 2#5#8 3#5#8 4#5#8 5#5# 1#6#8 2#6#8 3#6#8 4#6#8 5#6#8 6#6# 1#7#8 2#7#8 3#7#8 4#7#8 5#7#8 6#7#8 7#7# 1#8#8 2#8#8 3#8#8 4#8#8 5#8#8 6#8#8 7#8#8 8#8#8]} {StartTesting ’GenerateTriple tests’} {Test {SolveAll proc {$ X} {GenerateTriple 1 1#1#1} X=ok end } ’==’ [ok]} {Test {SolveAll proc {$ X} {GenerateTriple 3 2#3#3} X=ok end } ’==’ [ok]} {Test {SolveAll proc {$ X} {GenerateTriple 3 1#3#3} X=ok end } ’==’ [ok]} {StartTesting done}
% $Id: PythagoreanTest.oz,v 1.1 2008/11/25 23:07:13 leavens Exp leavens $ \insert ’Pythagorean.oz’ \insert ’SolveAll.oz’ \insert ’TestingNoStop.oz’ {StartTesting ’Pythagorean’} {Test {SolveAll proc {$ Triple} {Pythagorean 4 Triple} end } ’==’ nil} {Test {SolveAll proc {$ Triple} {Pythagorean 5 Triple} end } ’==’ [3#4#5]} {Test {SolveAll proc {$ Triple} {Pythagorean 10 Triple} end } ’==’ [6#8#10]} {Test {SolveAll proc {$ Triple} {Pythagorean 13 Triple} end } ’==’ [5#12#13]} {Test {SolveAll proc {$ Triple} {Pythagorean 14 Triple} end } ’==’ nil} {Test {SolveAll proc {$ Triple} {Pythagorean 15 Triple} end } ’==’ [9#12#15]} {Test {SolveAll proc {$ Triple} {Pythagorean 17 Triple} end } ’==’ [8#15#17]} {Test {SolveAll proc {$ Triple} {Pythagorean 20 Triple} end } ’==’ [12#16#20]} {Test {SolveAll proc {$ Triple} {Pythagorean 25 Triple} end } ’==’ [15#20#25 7#24#25]} {Test {SolveAll proc {$ Triple} {Pythagorean 50 Triple} end } ’==’ [30#40#50 14#48#50]} {StartTesting done}
Suggested Practice Problems
% $Id: PythagoreanSearchTest.oz,v 1.2 2008/11/25 23:40:32 leavens Exp leavens $ \insert ’PythagoreanSearch.oz’ \insert ’TestingNoStop.oz’ {StartTesting ’PythagoreanSearch’} {Test {List.take {PythagoreanSearch 4} 10} ’==’ nil} {Test {List.take {PythagoreanSearch 5} 10} ’==’ [3#4#5]} {Test {List.take {PythagoreanSearch 10} 10} ’==’ [3#4#5 6#8#10]} {Test {List.take {PythagoreanSearch 20} 15} ’==’ [3#4#5 6#8#10 5#12#13 9#12#15 8#15#17 12#16#20]} {Test {List.take {PythagoreanSearch 50} 20} ’==’ [3#4#5 6#8#10 5#12#13 9#12#15 8#15#17 12#16# 15#20#25 7#24#25 10#24#26 20#21#29 18#24# 16#30#34 21#28#35 12#35#37 15#36#39 24#32# 9#40#41 27#36#45 30#40#50 14#48#50]} {StartTesting done}
Points
References