2 . /cs/www/classes/cs372/spring15/a2/tests /cs/www/classes/cs372/spring15/a2/master # # 'problem' lines specify a problem name (for -p) and source file(s) for the problem problem warmup warmup.hs # # Just 'runghc' is enough to see if it compiles. If there's a compilation error, there's # an exit code of 1. If not, it should encounter a missing main, but then the exit code is 0. # If that latter behavior changes then we'll need to go back to using build-hs # build runghc warmup.hs # # 'test' lines specify a test name and then any files that should be # copied from the tests directory ($t) into the student's directory before # running the tests. (Take a look at $t/tesths) # # test lst tesths # # A 'template' line specifies the command that should be run for # the following cases. The text "" is replaced by the text # of each case in turn, starting with the text after any options. # # For "case -points=0.1 lst [1,2,3]", this command gets run: # tesths warmup.hs 'lst [1,2,3]' # # The output from the cases below are in lst.out.[0-n]. The name # "lst" comes from "test lst ..." above. # template ulimit -t 2; ./tesths warmup.hs '' case lst [1,2,3] case lst "abcde" case lst [1..100] case lst [[1]] case lst [] test initial tesths template ulimit -t 2; ./tesths warmup.hs '' case initial [1,2,3] case initial "abcde" case initial [1,2] case initial [1..10] case initial [] test repl tesths template ulimit -t 2; ./tesths warmup.hs '' case repl 0 "a" case repl 5 "a" case repl 5 (head "a") case repl 3 [1,2] case repl 2 (repl 3 [1,2]) test drp tesths template ulimit -t 2; ./tesths warmup.hs '' case drp 0 "abc" case drp 1 "a" case drp 1 [1..5] case drp 10 "abc" case drp (-1) "abc" test tk tesths template ulimit -t 2; ./tesths warmup.hs '' case tk 0 "abc" case tk 1 "abc" case tk 10 [1..5] case tk 3 "abc" case tk (-1) "abc" test has tesths template ulimit -t 2; ./tesths warmup.hs '' case has 1 [1..5] case has 3 [1..5] case has 5 [1..5] case has 6 [1..5] case has (2,2) (zip [1..3] [1..3]) case has (2,3) (zip [1..3] [1..3]) test concat2 tesths template ulimit -t 2; ./tesths warmup.hs '' case concat2 "abc" "xyz" case concat2 "testing" "" case concat2 "" "testing" case concat2 [1,2,3] [1,2,3] case concat2 [1] [1] case concat2 [] [] problem ftypes ftypes.hs build runghc ftypes.hs test ftypes template ulimit -t 2; echo '' | ghci -ignore-dot-ghci ftypes.hs 2>&1 | ruby /cs/www/classes/cs372/spring15/a2/fixftypes.rb case :t fa case :t fb case :t fc case :t fd case :t fe test ftypes-restrict case /cs/www/classes/cs372/spring15/a2/check-ftypes ftypes.hs problem join join.hs build runghc join.hs test join tesths template ulimit -t 2; ./tesths join.hs '' case join "." ["a","bc","def"] case join ", " ["a", "bc"] case join "" ["a","bc","def", "g", "h"] case join "..." ["test"] case join "..." [] case join ".." ["","","x","",""] case join "-" (words "just testing this") case join "" [] problem tob tob.hs build runghc tob.hs test tob tesths template ulimit -t 2; ./tesths tob.hs "" case tob 5 case tob 1 case tob 4 case tob 127 case tob 1025 case tob 32767 case tob 32768 case tob 100000000 problem splits splits.hs build runghc splits.hs test splits tesths template ulimit -t 2; ./tesths splits.hs '' case splits [1..4] case splits "xyz" case splits [True, False] case splits (replicate 5 []) case length (splits [1..50]) case splits [1] problem cpfx cpfx.hs build runghc cpfx.hs test cpfx tesths template ulimit -t 2; ./tesths cpfx.hs '' case cpfx ["abc", "ab", "abcd"] case cpfx ["abc", "abcef", "a123"] case cpfx ["xabc", "xabcef", "axbc"] case cpfx ["obscure", "obscures", "obscured", "obscuring"] case cpfx ["abc", "acb", "bac"] case cpfx ["xabc"] case cpfx ["aaa", "aaa", "aaa"] case cpfx ["aaa", "aa", "a"] case cpfx ["", "123", "123", "123"] case cpfx $ map show [20..29] problem paired paired.hs build runghc paired.hs test paired tesths template ulimit -t 2; ./tesths paired.hs '' case paired "()" case paired "(a+b)*(c-d)" case paired "(()()(()))" case paired "((1)(2)((3)))" case paired "((()(()()((((()))))((())))))" case paired ")" case paired "(" case paired "())" case paired "(a+b)*((c-d)" case paired ")(" case paired ")))(((" case paired "[(3,0,a), (3,4,b) ,(1,0,c), (5,7,d), (2,0,e)]" case paired "(.........)" case paired "()()()()()()()()()()()()()" problem street street.hs build runghc street.hs test street1 tesths #template tesths street.hs "" template ulimit -t 1; echo "" | ghci -ignore-dot-ghci street.hs 2>&1 | ruby /cs/www/classes/cs372/spring15/a2/fixstreet.rb case street [(3,2,'x'), (2,6,'y'), (5,4,'z')] case street [(3,0,'a'), (3,4,'b') ,(1,0,'c'), (5,7,'d'), (2,0,'e')] case street [(5,0,'x')] case street [(2,5,'x')] case street [(5,0,'x'), (2,5,'x'), (3,2,'x'),(2,6,'y'),(5,4,'z'), (3,0,'a'),(30,4,'b'),(12,0,'c'),(5,7,'0'),(2,0,'1'),(1, 5, '|'), (5, 5, ' '), (1, 5, '|')] problem editstr editstr.hs build runghc editstr.hs test editstr tesths template ulimit -t 2; ./tesths editstr.hs '' case editstr [("rep", " ", "_"), ("xlt", "aeiou", "AEIOU")] "just a test" case editstr [("rep", "o", ""), ("rep", "e", "eee")] "toothsomeness" case editstr [("xlt", "123456789", "xxxxxxxxx"), ("rep", "x", "")] "5203-3100-1230" case editstr [("len", "", "")] "testing" case editstr [("rev", "", "")] "testing" case editstr [("x", "3", "")] "xy" case editstr [("x", "0", "")] "the" case editstr [] "test" case editstr [("rep", " ", "_"), ("rep", "_", " ")] "t_ e _st" case editstr [("x","2",""),("len","",""),("x","3",""),("rev","",""),("xlt","1","x")] "testing" case editstr [("xlt","123456789","xxxxxxxxx"),("rep","x","")] "5203-3100-1230" case editstr [("rep", " ", "_"), ("xlt", "aeiou", "AEIOU"), ("rep", "o", ""), ("rep", "e", "eee"), ("xlt", "123456789", "xxxxxxxxx"), ("rep", "x", "")] (map Data.Char.chr [32..127]) case editstr [("foo", "the", "bar")] "test" case editstr [("rep", "xx", "yy")] "test" case editstr [("xlt", "abc", "1")] "test" # #problem hello hello.hs #build runghc hello.hs #test hello tesths #template ulimit -t 2; ./tesths hello.hs '' # #case :type hello #case hello "world" # #problem letters letters.hs #build runghc letters.hs #test letters tesths #template ulimit -t 2; ./tesths letters.hs '' # #case letters 4 #