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))
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 ]))
def testSolve6(self): self.assertEquals(27, StrJoin().calCost([1, 1, 1, 1, 1, 1, 1, 2]))
def testSolve5(self): self.assertEquals( 27, StrJoin().calCostWithSortMethod([1, 1, 1, 1, 1, 1, 1, 2], self.mySort))
def testSolve4(self): self.assertEquals( 26, StrJoin().calCostWithSortMethod([3, 1, 3, 4, 1], self.mySort))
def testSolve3(self): self.assertEquals( 12, StrJoin().calCostWithSortMethod([2, 4, 2], self.mySort))
def testSolve2(self): self.assertEquals(12, StrJoin().calCostWithSortMethod([2, 4, 2], sorted))
def testSolve(self): self.assertEquals(12, StrJoin().calCost([2, 4, 2]))