FPEvalDataset/LeetCodeProblem
0304
1 2module Main where3import Test.HUnit4 5--Program start6maxSum :: [Int] -> Int7maxSum nums = undefined8 9--Program end10 11-- Test cases12 13test1 :: Test14test1 = TestCase (assertEqual "for (maxSum [1,2,3,4,5])," 15 (maxSum [1,2,3,4,5]))15 16test2 :: Test17test2 = TestCase (assertEqual "for (maxSum [1,1,0,1,1])," 1 (maxSum [1,1,0,1,1]))18 19test3 :: Test20test3 = TestCase (assertEqual "for (maxSum [1,2,-1,-2,1,0,-1])," 3 (maxSum [1,2,-1,-2,1,0,-1]))21 22test4 :: Test23test4 = TestCase (assertEqual "for (maxSum [-78, 12, 44, 52, ( -46), ( -75), ( -71), 13, 53, ( -100), 19, 11, 57, 67, 69, 96, ( -95), 6, 71, 29, ( -13), ( -69), ( -29), ( -41), ( -66), ( -87), ( -18), 37, ( -2), ( -85), ( -59), 49, ( -21), 90, 41, ( -91), 51, 82, ( -89), ( -30), ( -61), ( -44), ( -49), ( -45), 17, 30, 9, ( -92)])," 1005 (maxSum [-78, 12, 44, 52, -46, -75, -71, 13, 53, -100, 19, 11, 57, 67, 69, 96, -95, 6, 71, 29, -13, -69, -29, -41, -66, -87, -18, 37, -2, -85, -59, 49, -21, 90, 41, -91, 51, 82, -89, -30, -61, -44, -49, -45, 17, 30, 9, -92]))24 25test5 :: Test26test5 = TestCase (assertEqual "for (maxSum [-32, 83, 14, 91, ( -80), 24, 64, ( -43), ( -16), ( -96), ( -25), 44, 59, 89, ( -78), 87, ( -40)])," 555 (maxSum [-32, 83, 14, 91, -80, 24, 64, -43, -16, -96, -25, 44, 59, 89, -78, 87, -40]))27 28test6 :: Test29test6 = TestCase (assertEqual "for (maxSum [90, ( -4), 4, 54, ( -3), 30, 39, 42, 11, 18, 32, 46, 79, ( -86), 36, 57, 33, ( -27), 13, 50, ( -45), ( -2), 80, 53, 96, 21, ( -14), ( -94), 93, ( -82), 2, 12, ( -37), ( -87), 48, ( -78), ( -92), 35, ( -53), ( -1)])," 1074 (maxSum [90, -4, 4, 54, -3, 30, 39, 42, 11, 18, 32, 46, 79, -86, 36, 57, 33, -27, 13, 50, -45, -2, 80, 53, 96, 21, -14, -94, 93, -82, 2, 12, -37, -87, 48, -78, -92, 35, -53, -1]))30 31test7 :: Test32test7 = TestCase (assertEqual "for (maxSum [94, ( -66), 100, 54, 57, 30, 98, ( -60)])," 433 (maxSum [94, -66, 100, 54, 57, 30, 98, -60]))33 34test8 :: Test35test8 = TestCase (assertEqual "for (maxSum [93, 49, ( -73), ( -47), ( -75), ( -72), 22, 20, ( -81), 76, 66, ( -88), 50, 75, 2, 65, 4, ( -92), ( -7), 29, 33, ( -36), ( -78), ( -1), 24, 11, 47, ( -64), 73, ( -50), ( -33)])," 739 (maxSum [93, 49, -73, -47, -75, -72, 22, 20, -81, 76, 66, -88, 50, 75, 2, 65, 4, -92, -7, 29, 33, -36, -78, -1, 24, 11, 47, -64, 73, -50, -33]))36 37 38-- Grouping test cases39tests :: Test40tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7]41 42-- Running the tests43main :: IO Counts44main = runTestTT tests45 