3 . a3/tests a3/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 build runghc-7.6.3 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 # # 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; a3/tesths warmup.hs '' case lst [1,2,3] case lst "abcde" case lst [1..100] case lst [[1]] case lst [] case lst [fst] test initial template ulimit -t 2; a3/tesths warmup.hs '' case initial [1,2,3] case initial "abcde" case initial [1,2] case initial [1..10] case initial [] case initial [length] test repl template ulimit -t 2; a3/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]) case repl 10 show test drp template ulimit -t 2; a3/tesths warmup.hs '' case drp 0 "abc" case drp 1 "a" case drp 1 [1..5] case drp 10 "abc" case drp (-1) "abc" case drp 1 [fst,snd] test tk template ulimit -t 2; a3/tesths warmup.hs '' case tk 0 "abc" case tk 1 "abc" case tk 10 [1..5] case tk 3 "abc" case tk (-1) "abc" case tk 1 [fst,snd] test has template ulimit -t 2; a3/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]) case has "test" (words "just a test") case has "not" (words "just a test") test concat2 template ulimit -t 2; a3/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 [] [] case concat2 [fst] [snd] problem join join.hs build runghc-7.6.3 join.hs test join template ulimit -t 2; a3/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 rme rme.hs build runghc-7.6.3 rme.hs test rme template ulimit -t 2; a3/tesths rme.hs "" case rme 3478 case rme 100100010010 case rme (17^19) case rme 2468 case rme 643186784023 case rme 123456789 problem splits splits.hs build runghc-7.6.3 splits.hs test splits template ulimit -t 2; a3/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] case splits [take,drop,take] case splits [1,1,2,2,3,3] problem cpfx cpfx.hs build runghc-7.6.3 cpfx.hs test cpfx template ulimit -t 2; a3/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-7.6.3 paired.hs test paired template ulimit -t 2; a3/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-7.6.3 street.hs test street #template tesths street.hs "" template ulimit -t 1; echo "" | ghci-7.6.3 -ignore-dot-ghci street.hs 2>&1 | ruby /cs/www/classes/cs372/spring16/a3/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-7.6.3 editstr.hs test editstr template ulimit -t 2; a3/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 ftypes ftypes.hs build runghc-7.6.3 ftypes.hs test ftypes template ulimit -t 2; echo '' | ghci-7.6.3 -ignore-dot-ghci ftypes.hs 2>&1 | tee out | ruby /cs/www/classes/cs372/spring16/a3/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/spring16/a3/check-ftypes ftypes.hs /* problem hello hello.hs build runghc-7.6.3 hello.hs test hello template ulimit -t 2; a3/tesths hello.hs '' case :type hello case hello "world" problem letters letters.hs build runghc-7.6.3 letters.hs test letters template ulimit -t 2; a3/tesths letters.hs '' case letters 4 */