Beispiel #1
0
    def test_jmp_3(self, input, mock_stdout):
        input.return_value = "123"
        expected = "1"

        day7.runCode([3,12,6,12,15,1,13,14,13,4,13,99,-1,0,1,9])
        regex = r"Output is: (-*\d+)"
        matches = re.findall(regex, mock_stdout.getvalue(), re.MULTILINE)
        self.assertEqual(matches[-1], expected)
Beispiel #2
0
    def test_les_6(self, input, mock_stdout):
        input.return_value = "9"
        expected = "0"

        day7.runCode([3,3,1107,-1,8,3,4,3,99])
        regex = r"Output is: (-*\d+)"
        matches = re.findall(regex, mock_stdout.getvalue(), re.MULTILINE)
        self.assertEqual(matches[-1], expected)
Beispiel #3
0
    def test_les_1(self, input, mock_stdout):
        input.return_value = "7"
        expected = "1"

        day7.runCode([3,9,7,9,10,9,4,9,99,-1,8])
        regex = r"Output is: (-*\d+)"
        matches = re.findall(regex, mock_stdout.getvalue(), re.MULTILINE)
        self.assertEqual(matches[-1], expected)
Beispiel #4
0
    def test_inp_2(self, input, mock_stdout):
        input.return_value = input_data = "-456"
        
        day7.runCode([3,0,4,0,99])

        regex = r"Output is: (-*\d+)"
        matches = re.findall(regex, mock_stdout.getvalue(), re.MULTILINE)

        self.assertEqual(matches[-1], input_data)
Beispiel #5
0
 def test_day5_1_7(self):
     self.assertEqual(day7.runCode([1101,100,-1,4,0]), [1101,100,-1,4,99])
Beispiel #6
0
 def test_day5_1_6(self):
     self.assertEqual(day7.runCode([1002,4,3,4,33]), [1002,4,3,4,99])
Beispiel #7
0
 def test_day5_1_5(self):
     self.assertEqual(day7.runCode([1,1,1,4,99,5,6,0,99]), [30,1,1,4,2,5,6,0,99])
Beispiel #8
0
 def test_day5_1_4(self):
     self.assertEqual(day7.runCode([2,4,4,5,99,0]), [2,4,4,5,99,9801])
Beispiel #9
0
 def test_day5_1_3(self):
     self.assertEqual(day7.runCode([2,3,0,3,99]), [2,3,0,6,99])
Beispiel #10
0
 def test_day5_1_2(self):
     self.assertEqual(day7.runCode([1,0,0,0,99]), [2,0,0,0,99])
Beispiel #11
0
 def test_day5_1_1(self):
     self.assertEqual(day7.runCode([1,9,10,3,2,3,11,0,99,30,40,50]), [3500,9,10,70,2,3,11,0,99,30,40,50])