예제 #1
0
 def testSolveWithCustomImproveMethod(self):
     self.assertEquals(
         3222,
         StrJoin().calCostWithSortMethod([
             1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5,
             6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 9,
             8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5,
             6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2,
             3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 1, 1, 1, 1, 1, 1,
             1, 1, 2
         ], self.myImproveSort))
예제 #2
0
 def testSolveWithDefaultSort(self):
     self.assertEquals(
         3222,
         StrJoin().calCost([
             1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5,
             6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 9,
             8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5,
             6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2,
             3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 1, 1, 1, 1, 1, 1,
             1, 1, 2
         ]))
예제 #3
0
 def testSolve6(self):
     self.assertEquals(27, StrJoin().calCost([1, 1, 1, 1, 1, 1, 1, 2]))
예제 #4
0
 def testSolve5(self):
     self.assertEquals(
         27,
         StrJoin().calCostWithSortMethod([1, 1, 1, 1, 1, 1, 1, 2],
                                         self.mySort))
예제 #5
0
 def testSolve4(self):
     self.assertEquals(
         26,
         StrJoin().calCostWithSortMethod([3, 1, 3, 4, 1], self.mySort))
예제 #6
0
 def testSolve3(self):
     self.assertEquals(
         12,
         StrJoin().calCostWithSortMethod([2, 4, 2], self.mySort))
예제 #7
0
 def testSolve2(self):
     self.assertEquals(12,
                       StrJoin().calCostWithSortMethod([2, 4, 2], sorted))
예제 #8
0
 def testSolve(self):
     self.assertEquals(12, StrJoin().calCost([2, 4, 2]))