CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes302downloads
Main.hs42 linesDownload Raw Back to haskell_tests
1 2module Main where3import Test.HUnit4 5--Program start6constructTransformedArray :: [Int] -> [Int]7constructTransformedArray nums = undefined8 9--Program end10 11-- Test cases12 13test1 :: Test14test1 = TestCase (assertEqual "for (constructTransformedArray [3,-2,1,1])," [1,1,1,3] (constructTransformedArray [3,-2,1,1]))15 16test2 :: Test17test2 = TestCase (assertEqual "for (constructTransformedArray [-1,4,-1])," [-1,-1,4] (constructTransformedArray [-1,4,-1]))18 19test3 :: Test20test3 = TestCase (assertEqual "for (constructTransformedArray [20, ( -26), 14, ( -18), ( -48), 74, 0, ( -26), ( -55), ( -82), 19, ( -55), 1, ( -93), ( -62), ( -31), ( -49), ( -20), 25, 84, ( -33), ( -75), 59, 64, ( -7), 5, ( -20), ( -89), 3, 27, 4, ( -57), 25, ( -38), ( -94), ( -15), ( -92), 75, ( -43), 60, ( -74), ( -33), ( -35), ( -22), ( -5), ( -10), 24, 80, ( -73), 67, ( -92), 58, 9, ( -31), 30, ( -56), ( -78)])," [-33,25,(-49),(-35),(-93),59,0,(-43),19,(-33),27,(-93),(-93),(-94),(-82),(-33),(-7),30,(-22),24,(-5),(-18),(-7),4,(-20),4,0,9,(-57),(-78),(-94),(-57),20,9,30,(-33),(-26),(-56),9,(-35),64,(-55),(-26),(-75),60,(-15),(-93),(-93),25,14,(-31),9,(-48),59,(-89),(-78),(-15)] (constructTransformedArray [20, -26, 14, -18, -48, 74, 0, -26, -55, -82, 19, -55, 1, -93, -62, -31, -49, -20, 25, 84, -33, -75, 59, 64, -7, 5, -20, -89, 3, 27, 4, -57, 25, -38, -94, -15, -92, 75, -43, 60, -74, -33, -35, -22, -5, -10, 24, 80, -73, 67, -92, 58, 9, -31, 30, -56, -78]))21 22test4 :: Test23test4 = TestCase (assertEqual "for (constructTransformedArray [-23, 42, 69, ( -97), ( -58), 97, ( -47), 65, 45, ( -93), 31, ( -44), ( -78), ( -49), 81, 60, 51, ( -80), ( -74), 87, 20, 1, 86, ( -32), ( -80), 58, ( -23), 6, ( -92), 9, ( -99), ( -11), 44, 71, 56, 50, 6, ( -64), ( -61)])," [51,(-58),44,(-32),(-80),(-80),(-64),71,81,71,69,(-47),(-78),(-97),(-80),6,(-92),60,86,(-92),42,86,(-99),(-99),86,97,(-97),71,81,(-61),(-93),20,(-64),(-23),(-78),65,(-97),(-78),51] (constructTransformedArray [-23, 42, 69, -97, -58, 97, -47, 65, 45, -93, 31, -44, -78, -49, 81, 60, 51, -80, -74, 87, 20, 1, 86, -32, -80, 58, -23, 6, -92, 9, -99, -11, 44, 71, 56, 50, 6, -64, -61]))24 25test5 :: Test26test5 = TestCase (assertEqual "for (constructTransformedArray [61, ( -63), ( -16), 10, ( -39), ( -16), ( -95), ( -44), ( -16), 21, 4, 18, ( -56), 53, 39, 69, 29, ( -87), 43, ( -75), ( -81), ( -3), ( -66), ( -18), ( -73), 38, 9, 75, ( -98), 43, 67, ( -49), 100, ( -9), 62, 32, ( -13), ( -2), ( -81), 79, 88, ( -1), 16, 27, 81, ( -90), ( -88), 15, 60, 33, ( -20), ( -12), 86, 20, 83, 10, ( -55), 88, 82, 32, 98, 7, ( -66), 60, 54, 50, ( -42), ( -99), 69, ( -29), ( -98), ( -51), ( -54), 65, ( -63), ( -16), 11, ( -82)])," [7,29,54,53,27,(-99),(-99),(-1),(-98),67,39,43,62,(-42),20,(-95),(-90),(-16),7,(-66),(-87),43,62,(-16),43,60,32,(-73),(-16),(-54),(-75),98,83,(-73),43,(-99),(-18),32,32,88,(-20),88,82,(-98),15,(-9),(-13),(-66),67,(-39),67,79,98,65,32,50,(-63),(-99),(-66),53,(-16),69,(-63),(-90),88,(-2),(-73),(-88),32,88,(-20),(-81),43,98,18,32,21,65] (constructTransformedArray [61, -63, -16, 10, -39, -16, -95, -44, -16, 21, 4, 18, -56, 53, 39, 69, 29, -87, 43, -75, -81, -3, -66, -18, -73, 38, 9, 75, -98, 43, 67, -49, 100, -9, 62, 32, -13, -2, -81, 79, 88, -1, 16, 27, 81, -90, -88, 15, 60, 33, -20, -12, 86, 20, 83, 10, -55, 88, 82, 32, 98, 7, -66, 60, 54, 50, -42, -99, 69, -29, -98, -51, -54, 65, -63, -16, 11, -82]))27 28test6 :: Test29test6 = TestCase (assertEqual "for (constructTransformedArray [55, ( -64), ( -7), ( -6), ( -30), ( -37), 16, 58, 57, 33, 62, 82, ( -6), 94, 65, 0, ( -74), ( -32), 50, 70, ( -85), 55, 43, ( -70), 38, 75, 98, 86, ( -79), 41, ( -80), 65, 68, ( -17), ( -15), ( -92), 84, 5, ( -93), ( -8), ( -10), 32, 46, 40])," [82,75,(-8),32,50,(-6),43,55,55,46,(-79),(-37),16,70,(-92),0,(-80),41,38,(-64),(-70),68,55,32,50,(-6),84,75,5,98,(-93),57,(-6),(-74),70,65,68,46,(-17),65,(-80),41,55,(-8)] (constructTransformedArray [55, -64, -7, -6, -30, -37, 16, 58, 57, 33, 62, 82, -6, 94, 65, 0, -74, -32, 50, 70, -85, 55, 43, -70, 38, 75, 98, 86, -79, 41, -80, 65, 68, -17, -15, -92, 84, 5, -93, -8, -10, 32, 46, 40]))30 31test7 :: Test32test7 = TestCase (assertEqual "for (constructTransformedArray [1, ( -93), 55, ( -75), 27, 83, 4, 93, ( -63), 60, 89, 46, 7, 5, ( -67), ( -62), ( -49), ( -18), 77, 2, 44, 48, 76, ( -58), 99, 92, ( -2), ( -99), ( -35), ( -32), ( -61), ( -26), 49, 95, ( -69)])," [-93,5,76,95,(-26),77,89,(-61),(-62),(-69),(-32),76,2,77,(-18),(-58),55,(-69),92,48,(-32),(-69),(-35),1,77,7,99,95,(-35),49,27,83,46,(-58),1] (constructTransformedArray [1, -93, 55, -75, 27, 83, 4, 93, -63, 60, 89, 46, 7, 5, -67, -62, -49, -18, 77, 2, 44, 48, 76, -58, 99, 92, -2, -99, -35, -32, -61, -26, 49, 95, -69]))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