def test_final_position_problem_statement_cases(self): self.assertEqual(2, final_position("RRLRRLLR", 10, 10)) self.assertEqual(4, final_position("RRRRR", 3, 4)) self.assertEqual(-1, final_position("LLLLLLLLLLR", 2, 6)) self.assertEqual(20, final_position( "RRRRRRRLRRLRRRRRRRRRRRRLRLRRRRRRRRLRRRRRLRRRRRRRRR", 5, 20)) self.assertEqual(-30, final_position("RLRLLLLLLLRLLLRLLLLLLLLRLLLLLRLLLRRLLLLLRLLLLLRLLL", 34, 15))
def test_final_position(self): self.assertEqual(2, final_position("RRLRRLLR", 10, 10)) self.assertEqual(4, final_position("RRRRR", 3, 4)) self.assertEqual(-1, final_position("LLLLLLLLLLR", 2, 6)) self.assertEqual(20, final_position("RRRRRRRLRRLRRRRRRRRRRRRLRLRRRRRRRRLRRRRRLRRRRRRRRR", 5, 20)) self.assertEqual(-30, final_position("RLRLLLLLLLRLLLRLLLLLLLLRLLLLLRLLLRRLLLLLRLLLLLRLLL", 34, 15))
def test_with_top_coder_examples(self): self.assertEqual(2, solution.final_position("RRLRRLLR", 10, 10)) self.assertEqual(4, solution.final_position("RRRRR", 3, 4)) self.assertEqual(-1, solution.final_position("LLLLLLLLLLR", 2, 6)) self.assertEqual(20, solution.final_position("RRRRRRRLRRLRRRRRRRRRRRRLR" + "LRRRRRRRRLRRRRRLRRRRRRRRR", 5, 20)) self.assertEqual(-30, solution.final_position("RLRLLLLLLLRLLLRLLLLLLLLRL" + "LLLLRLLLRRLLLLLRLLLLLRLLL", 34, 15))
def test_final_position_2(self): self.assertEqual(4, solution.final_position("RRRRR", 3, 4))
def test_final_position_1(self): self.assertEqual(2, solution.final_position("RRLRRLLR", 10, 10))
def test_final_position_6(self): self.assertEqual(6, solution.final_position("RRRLLLRLRLRLLLRRRRRRRR", 32, 21))
def test_final_position_5(self): self.assertEqual(-30, solution.final_position("RLRLLLLLLLRLLLRLLLLLLLLRLLLLLRLLLRRLLLLLRLLLLLRLLL", 34, 15))
def test_final_position_4(self): self.assertEqual(20, solution.final_position( "RRRRRRRLRRLRRRRRRRRRRRRLRLRRRRRRRRLRRRRRLRRRRRRRRR", 5, 20))
def test_final_position_3(self): self.assertEqual(-1, solution.final_position("LLLLLLLLLLR", 2, 6))
def test_four(self): self.assertEqual(-30, final_position("RLRLLLLLLLRLLLRLLLLLLLLRLLLLLRLLLRRLLLLLRLLLLLRLLL", 34, 15))
def test_three(self): self.assertEqual(20, final_position("RRRRRRRLRRLRRRRRRRRRRRRLRLRRRRRRRRLRRRRRLRRRRRRRRR", 5, 20))
def test_two(self): self.assertEqual(-1, final_position("LLLLLLLLLLR", 2, 6))
def test_one(self): self.assertEqual(4, final_position("RRRRR", 3, 4))
def test_null(self): self.assertEqual(2, final_position("RRLRRLLR", 10, 10))