예제 #1
0
    def test_it_parses_retrieve(self):
        instructions = parse('\t\t\t')
        instruction = instructions[0]

        self.assertEqual(len(instructions), 1)
        self.assertIsInstance(instruction, Retrieve)
        self.assertEqual(instruction.source_location,
                         SourceLocation(0, 0, 0, 2, 0, 2))
예제 #2
0
    def test_it_parses_mod(self):
        instructions = parse('\t \t\t')
        instruction = instructions[0]

        self.assertEqual(len(instructions), 1)
        self.assertIsInstance(instruction, Mod)
        self.assertEqual(instruction.source_location,
                         SourceLocation(0, 0, 0, 3, 0, 3))
예제 #3
0
    def test_it_parses_discard(self):
        instructions = parse(' \n\n')
        instruction = instructions[0]

        self.assertEqual(len(instructions), 1)
        self.assertIsInstance(instruction, Discard)
        self.assertEqual(instruction.source_location,
                         SourceLocation(0, 0, 0, 2, 1, 0))
예제 #4
0
    def test_it_parses_getn(self):
        instructions = parse('\t\n\t\t')
        instruction = instructions[0]

        self.assertEqual(len(instructions), 1)
        self.assertIsInstance(instruction, Getn)
        self.assertEqual(instruction.source_location,
                         SourceLocation(0, 0, 0, 3, 1, 1))
예제 #5
0
    def test_it_parses_push(self):
        instructions = parse('  \t\t \t\n')
        instruction = instructions[0]

        self.assertEqual(len(instructions), 1)
        self.assertIsInstance(instruction, Push)
        self.assertEqual(instruction.n, -5)
        self.assertEqual(instruction.source_location,
                         SourceLocation(0, 0, 0, 6, 0, 6))
예제 #6
0
    def test_it_parses_njmp(self):
        instructions = parse('\n\t\t \n')
        instruction = instructions[0]

        self.assertEqual(len(instructions), 1)
        self.assertIsInstance(instruction, Njmp)
        self.assertEqual(instruction.name, ' ')
        self.assertEqual(instruction.source_location,
                         SourceLocation(0, 0, 0, 4, 1, 3))