TheRealSamuel/LeetCodeProblem
0572
1 2module Main where3import Test.HUnit4 5--Program start6sortMatrix :: [[Int]] -> [[Int]]7sortMatrix grid = undefined8 9--Program end10 11-- Test cases12 13test1 :: Test14test1 = TestCase (assertEqual "for (sortMatrix [[1,7,3],[9,8,2],[4,5,6]])," [[8,2,3],[9,6,7],[4,5,1]] (sortMatrix [[1,7,3],[9,8,2],[4,5,6]]))15 16test2 :: Test17test2 = TestCase (assertEqual "for (sortMatrix [[0,1],[1,2]])," [[2,1],[1,0]] (sortMatrix [[0,1],[1,2]]))18 19test3 :: Test20test3 = TestCase (assertEqual "for (sortMatrix [[1]])," [[1]] (sortMatrix [[1]]))21 22test4 :: Test23test4 = TestCase (assertEqual "for (sortMatrix [[73413, 89675], [64042, 3426]])," [[73413,89675],[64042,3426]] (sortMatrix [[73413, 89675], [64042, 3426]]))24 25test5 :: Test26test5 = TestCase (assertEqual "for (sortMatrix [[93534, ( -60538), 1100, ( -29080)], [73904, 73681, ( -42006), 58036], [-54576, 43994, ( -44130), ( -9191)], [35790, ( -98159), ( -43670), ( -71219)]])," [[93534,(-60538),1100,(-29080)],[73904,73681,(-42006),58036],[-54576,43994,(-44130),(-9191)],[35790,(-98159),(-43670),(-71219)]] (sortMatrix [[93534, -60538, 1100, -29080], [73904, 73681, -42006, 58036], [-54576, 43994, -44130, -9191], [35790, -98159, -43670, -71219]]))27 28test6 :: Test29test6 = TestCase (assertEqual "for (sortMatrix [[59508, ( -30375), 53549], [76794, ( -45364), 68655], [59076, ( -95778), ( -72798)]])," [[59508,(-30375),53549],[76794,(-45364),68655],[59076,(-95778),(-72798)]] (sortMatrix [[59508, -30375, 53549], [76794, -45364, 68655], [59076, -95778, -72798]]))30 31test7 :: Test32test7 = TestCase (assertEqual "for (sortMatrix [[70237, ( -28097), ( -75510), ( -93714), ( -13815), ( -81959), ( -59992), ( -43975), ( -70863)], [40288, 50377, ( -15278), ( -54865), ( -78871), 38194, ( -64139), ( -23739), 83299], [75198, 26853, 45303, 17073, ( -52554), ( -69846), 41075, ( -10375), 61633], [71858, 25443, ( -12504), 17141, 46172, ( -23439), 16688, 46570, 24044], [59184, 60566, 13801, ( -28186), ( -2540), 59190, ( -3452), 81433, 67105], [90462, 37330, 57191, ( -30681), ( -44432), ( -22472), 59534, 27280, 83274], [99727, 15152, ( -37289), 36698, ( -39528), ( -47895), ( -50758), 75176, 62571], [83565, ( -16059), ( -17953), ( -40686), 35575, ( -41645), ( -74717), ( -80703), 78122], [12632, 65938, ( -48947), ( -75351), ( -84100), ( -18388), ( -96082), ( -97690), ( -92412)]])," [[70237,(-28097),(-75510),(-93714),(-13815),(-81959),(-59992),(-43975),(-70863)],[40288,50377,(-15278),(-54865),(-78871),38194,(-64139),(-23739),83299],[75198,26853,45303,17073,(-52554),(-69846),41075,(-10375),61633],[71858,25443,(-12504),17141,46172,(-23439),16688,46570,24044],[59184,60566,13801,(-28186),(-2540),59190,(-3452),81433,67105],[90462,37330,57191,(-30681),(-44432),(-22472),59534,27280,83274],[99727,15152,(-37289),36698,(-39528),(-47895),(-50758),75176,62571],[83565,(-16059),(-17953),(-40686),35575,(-41645),(-74717),(-80703),78122],[12632,65938,(-48947),(-75351),(-84100),(-18388),(-96082),(-97690),(-92412)]] (sortMatrix [[70237, -28097, -75510, -93714, -13815, -81959, -59992, -43975, -70863], [40288, 50377, -15278, -54865, -78871, 38194, -64139, -23739, 83299], [75198, 26853, 45303, 17073, -52554, -69846, 41075, -10375, 61633], [71858, 25443, -12504, 17141, 46172, -23439, 16688, 46570, 24044], [59184, 60566, 13801, -28186, -2540, 59190, -3452, 81433, 67105], [90462, 37330, 57191, -30681, -44432, -22472, 59534, 27280, 83274], [99727, 15152, -37289, 36698, -39528, -47895, -50758, 75176, 62571], [83565, -16059, -17953, -40686, 35575, -41645, -74717, -80703, 78122], [12632, 65938, -48947, -75351, -84100, -18388, -96082, -97690, -92412]]))33 34test8 :: Test35test8 = TestCase (assertEqual "for (sortMatrix [[93680, ( -89587), ( -96793), ( -88056), ( -67363), ( -57242), ( -67539), ( -78121), ( -55829), ( -57391)], [70507, 28181, ( -65217), ( -76332), ( -42429), ( -38150), ( -48555), ( -2009), ( -63212), 39636], [69116, 50346, 23408, ( -40122), ( -75329), 29472, ( -21407), ( -29091), ( -468), 29793], [64817, 39118, 38117, 4200, 31191, ( -62081), 42875, 4261, 43215, 1967], [73153, 49917, 23947, 32443, ( -25788), 51430, ( -30848), 66550, 62937, 91163], [48378, 66018, 37406, ( -4699), 21998, ( -41176), 78126, 19189, 79570, 81497], [-23104, 19536, 53987, 29462, ( -10253), 16954, ( -47341), 80533, 52244, 81496], [66168, ( -30888), ( -18525), 40048, 23718, ( -52041), ( -14933), ( -49448), 90366, 99859], [55807, 60419, ( -45089), ( -30668), 8678, ( -10026), ( -56978), ( -16041), ( -78687), 91900], [-31370, ( -47928), ( -12268), ( -84613), ( -76766), ( -42972), ( -74771), ( -88090), ( -58183), ( -79213)]])," [[93680,(-89587),(-96793),(-88056),(-67363),(-57242),(-67539),(-78121),(-55829),(-57391)],[70507,28181,(-65217),(-76332),(-42429),(-38150),(-48555),(-2009),(-63212),39636],[69116,50346,23408,(-40122),(-75329),29472,(-21407),(-29091),(-468),29793],[64817,39118,38117,4200,31191,(-62081),42875,4261,43215,1967],[73153,49917,23947,32443,(-25788),51430,(-30848),66550,62937,91163],[48378,66018,37406,(-4699),21998,(-41176),78126,19189,79570,81497],[-23104,19536,53987,29462,(-10253),16954,(-47341),80533,52244,81496],[66168,(-30888),(-18525),40048,23718,(-52041),(-14933),(-49448),90366,99859],[55807,60419,(-45089),(-30668),8678,(-10026),(-56978),(-16041),(-78687),91900],[-31370,(-47928),(-12268),(-84613),(-76766),(-42972),(-74771),(-88090),(-58183),(-79213)]] (sortMatrix [[93680, -89587, -96793, -88056, -67363, -57242, -67539, -78121, -55829, -57391], [70507, 28181, -65217, -76332, -42429, -38150, -48555, -2009, -63212, 39636], [69116, 50346, 23408, -40122, -75329, 29472, -21407, -29091, -468, 29793], [64817, 39118, 38117, 4200, 31191, -62081, 42875, 4261, 43215, 1967], [73153, 49917, 23947, 32443, -25788, 51430, -30848, 66550, 62937, 91163], [48378, 66018, 37406, -4699, 21998, -41176, 78126, 19189, 79570, 81497], [-23104, 19536, 53987, 29462, -10253, 16954, -47341, 80533, 52244, 81496], [66168, -30888, -18525, 40048, 23718, -52041, -14933, -49448, 90366, 99859], [55807, 60419, -45089, -30668, 8678, -10026, -56978, -16041, -78687, 91900], [-31370, -47928, -12268, -84613, -76766, -42972, -74771, -88090, -58183, -79213]]))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 