File size: 3,305 Bytes
0a33073 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
module Main where
import Test.HUnit
--Program start
--Program end
-- Test cases
test1 :: Test
test1 = TestCase (assertEqual "for (minimumBoxes [1,3,2] [4,3,1,5,2])," 2 (minimumBoxes [1,3,2] [4,3,1,5,2]))
test2 :: Test
test2 = TestCase (assertEqual "for (minimumBoxes [5,5,5] [2,4,2,7])," 4 (minimumBoxes [5,5,5] [2,4,2,7]))
test3 :: Test
test3 = TestCase (assertEqual "for (minimumBoxes [12, 39, 47, 10, 21, 26, 7, 50] [49, 43, 35, 30, 29, 28, 24, 7])," 6 (minimumBoxes [12, 39, 47, 10, 21, 26, 7, 50] [49, 43, 35, 30, 29, 28, 24, 7]))
test4 :: Test
test4 = TestCase (assertEqual "for (minimumBoxes [35, 48, 40, 16, 43, 36, 41, 4] [46, 45, 45, 44, 43, 40, 38, 38, 36, 34, 34, 33, 30, 29, 28, 26, 25, 24, 22, 22, 19, 18, 17, 7, 2, 2, 2, 1])," 6 (minimumBoxes [35, 48, 40, 16, 43, 36, 41, 4] [46, 45, 45, 44, 43, 40, 38, 38, 36, 34, 34, 33, 30, 29, 28, 26, 25, 24, 22, 22, 19, 18, 17, 7, 2, 2, 2, 1]))
test5 :: Test
test5 = TestCase (assertEqual "for (minimumBoxes [18, 45, 11, 47, 26, 2, 39, 48, 43, 16, 4, 17, 48, 44, 2, 21, 41, 40, 17, 29, 35, 23, 45, 30, 31, 34, 39] [205, 50, 45, 45, 45, 42, 39, 37, 35, 35, 31, 27, 26, 24, 24, 21, 21, 15, 14, 8, 6])," 21 (minimumBoxes [18, 45, 11, 47, 26, 2, 39, 48, 43, 16, 4, 17, 48, 44, 2, 21, 41, 40, 17, 29, 35, 23, 45, 30, 31, 34, 39] [205, 50, 45, 45, 45, 42, 39, 37, 35, 35, 31, 27, 26, 24, 24, 21, 21, 15, 14, 8, 6]))
test6 :: Test
test6 = TestCase (assertEqual "for (minimumBoxes [46, 5, 6, 15, 47, 20, 16, 19, 42, 44, 44, 28, 28, 19, 16, 26, 47, 12, 39, 40, 25, 25, 48, 3, 17, 6, 21, 22, 20, 2, 50, 50, 26, 26, 41, 5, 9, 31, 19, 40, 26] [719, 50, 49, 41, 31, 28, 28, 23, 22, 20, 15, 11, 11, 10, 8, 5])," 16 (minimumBoxes [46, 5, 6, 15, 47, 20, 16, 19, 42, 44, 44, 28, 28, 19, 16, 26, 47, 12, 39, 40, 25, 25, 48, 3, 17, 6, 21, 22, 20, 2, 50, 50, 26, 26, 41, 5, 9, 31, 19, 40, 26] [719, 50, 49, 41, 31, 28, 28, 23, 22, 20, 15, 11, 11, 10, 8, 5]))
test7 :: Test
test7 = TestCase (assertEqual "for (minimumBoxes [14, 12, 1, 27, 27, 29, 14, 12, 7, 6, 8, 42, 34, 42, 44, 46, 27, 49, 36, 24] [163, 46, 44, 44, 40, 37, 35, 34, 25, 12, 9, 8, 4])," 13 (minimumBoxes [14, 12, 1, 27, 27, 29, 14, 12, 7, 6, 8, 42, 34, 42, 44, 46, 27, 49, 36, 24] [163, 46, 44, 44, 40, 37, 35, 34, 25, 12, 9, 8, 4]))
test8 :: Test
test8 = TestCase (assertEqual "for (minimumBoxes [28, 3, 15, 44, 49, 25, 11, 50, 32, 2] [43, 39, 37, 36, 35, 35, 33, 32, 28, 25, 20, 16, 16, 6, 3, 2])," 8 (minimumBoxes [28, 3, 15, 44, 49, 25, 11, 50, 32, 2] [43, 39, 37, 36, 35, 35, 33, 32, 28, 25, 20, 16, 16, 6, 3, 2]))
test9 :: Test
test9 = TestCase (assertEqual "for (minimumBoxes [38, 42, 47, 16, 36] [50, 49, 48, 47, 47, 47, 44, 44, 42, 38, 36, 35, 35, 34, 34, 33, 31, 29, 29, 26, 26, 23, 19, 19, 18, 15, 14, 14, 13, 12, 12, 11, 8, 7, 7, 5, 4, 1, 1])," 4 (minimumBoxes [38, 42, 47, 16, 36] [50, 49, 48, 47, 47, 47, 44, 44, 42, 38, 36, 35, 35, 34, 34, 33, 31, 29, 29, 26, 26, 23, 19, 19, 18, 15, 14, 14, 13, 12, 12, 11, 8, 7, 7, 5, 4, 1, 1]))
-- Grouping test cases
tests :: Test
tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7, TestLabel "Test8" test8, TestLabel "Test9" test9]
-- Running the tests
main :: IO Counts
main = runTestTT tests
|