FPEvalDataset/LeetCodeProblem
0302
1 2module Main where3import Test.HUnit4 5--Program start6alternatingSubarray :: [Int] -> Int7alternatingSubarray nums = undefined8 9--Program end10 11-- Test cases12 13test1 :: Test14test1 = TestCase (assertEqual "for (alternatingSubarray [2,3,4,3,4])," 4 (alternatingSubarray [2,3,4,3,4]))15 16test2 :: Test17test2 = TestCase (assertEqual "for (alternatingSubarray [4,5,6])," 2 (alternatingSubarray [4,5,6]))18 19test3 :: Test20test3 = TestCase (assertEqual "for (alternatingSubarray [54, 16, 32, 95, 67, 55, 86, 56, 31, 70, 16, 68, 90, 20, 43, 33, 67, 50, 75, 12, 55, 63, 26, 45, 31, 55, 17, 20, 83, 34, 63, 51, 82, 103, 88, 88, 8, 66, 76, 85, 93, 24, 4, 70, 5, 40, 46, 99, 88, 88, 8, 40, 58, 22, 39, 37, 39, 92, 29, 26, 44, 90, 38, 15, 48, 77, 76, 10, 96, 7, 26, 7, 95, 93])," (-1) (alternatingSubarray [54, 16, 32, 95, 67, 55, 86, 56, 31, 70, 16, 68, 90, 20, 43, 33, 67, 50, 75, 12, 55, 63, 26, 45, 31, 55, 17, 20, 83, 34, 63, 51, 82, 103, 88, 88, 8, 66, 76, 85, 93, 24, 4, 70, 5, 40, 46, 99, 88, 88, 8, 40, 58, 22, 39, 37, 39, 92, 29, 26, 44, 90, 38, 15, 48, 77, 76, 10, 96, 7, 26, 7, 95, 93]))21 22test4 :: Test23test4 = TestCase (assertEqual "for (alternatingSubarray [62, 77, 25, 40, 7, 16, 33, 76, 103, 72, 89, 50, 18, 58, 45, 28, 50, 88, 43, 65, 46, 100, 29, 65, 27, 29, 25, 8, 2, 33, 62, 34, 14, 20, 20, 40, 87, 75, 49, 53, 65, 87, 30, 100, 38, 9, 72, 86, 44, 10, 41, 53, 92, 99, 102, 14, 47, 34])," (-1) (alternatingSubarray [62, 77, 25, 40, 7, 16, 33, 76, 103, 72, 89, 50, 18, 58, 45, 28, 50, 88, 43, 65, 46, 100, 29, 65, 27, 29, 25, 8, 2, 33, 62, 34, 14, 20, 20, 40, 87, 75, 49, 53, 65, 87, 30, 100, 38, 9, 72, 86, 44, 10, 41, 53, 92, 99, 102, 14, 47, 34]))24 25test5 :: Test26test5 = TestCase (assertEqual "for (alternatingSubarray [50, 30, 88, 101, 99, 23, 27, 91, 21])," (-1) (alternatingSubarray [50, 30, 88, 101, 99, 23, 27, 91, 21]))27 28test6 :: Test29test6 = TestCase (assertEqual "for (alternatingSubarray [3, 23, 16, 46])," (-1) (alternatingSubarray [3, 23, 16, 46]))30 31test7 :: Test32test7 = TestCase (assertEqual "for (alternatingSubarray [38, 73, 92, 36, 95, 99, 83, 14, 95, 4, 91, 89, 82, 62, 22, 40, 102, 25, 45, 88, 60, 80, 36, 104, 71, 28, 39, 44, 44, 38, 65, 14, 29, 43, 17, 18, 22, 79, 39, 98, 102, 55, 81, 25, 104, 60, 6])," 2 (alternatingSubarray [38, 73, 92, 36, 95, 99, 83, 14, 95, 4, 91, 89, 82, 62, 22, 40, 102, 25, 45, 88, 60, 80, 36, 104, 71, 28, 39, 44, 44, 38, 65, 14, 29, 43, 17, 18, 22, 79, 39, 98, 102, 55, 81, 25, 104, 60, 6]))33 34 35-- Grouping test cases36tests :: Test37tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6]38 39-- Running the tests40main :: IO Counts41main = runTestTT tests42 