Example #1
0
 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))
Example #2
0
 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))
Example #3
0
 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))
Example #4
0
 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))
Example #5
0
 def test_final_position_2(self):
     self.assertEqual(4, solution.final_position("RRRRR", 3, 4))
Example #6
0
 def test_final_position_1(self):
     self.assertEqual(2, solution.final_position("RRLRRLLR", 10, 10))
Example #7
0
 def test_final_position_6(self):
     self.assertEqual(6, solution.final_position("RRRLLLRLRLRLLLRRRRRRRR", 32, 21))
Example #8
0
 def test_final_position_5(self):
     self.assertEqual(-30, solution.final_position("RLRLLLLLLLRLLLRLLLLLLLLRLLLLLRLLLRRLLLLLRLLLLLRLLL", 34, 15))
Example #9
0
 def test_final_position_4(self):
     self.assertEqual(20, solution.final_position(
         "RRRRRRRLRRLRRRRRRRRRRRRLRLRRRRRRRRLRRRRRLRRRRRRRRR", 5, 20))
Example #10
0
 def test_final_position_3(self):
     self.assertEqual(-1, solution.final_position("LLLLLLLLLLR", 2, 6))
Example #11
0
 def test_four(self):
     self.assertEqual(-30, final_position("RLRLLLLLLLRLLLRLLLLLLLLRLLLLLRLLLRRLLLLLRLLLLLRLLL", 34, 15))
Example #12
0
 def test_three(self):
      self.assertEqual(20, final_position("RRRRRRRLRRLRRRRRRRRRRRRLRLRRRRRRRRLRRRRRLRRRRRRRRR", 5, 20))
Example #13
0
 def test_two(self):
     self.assertEqual(-1, final_position("LLLLLLLLLLR", 2, 6))
Example #14
0
 def test_one(self):
     self.assertEqual(4, final_position("RRRRR", 3, 4))
Example #15
0
 def test_null(self):
     self.assertEqual(2, final_position("RRLRRLLR", 10, 10))