Skip to content

Commit

Permalink
Merge branch '0.2.x' of github.com:gutomaia/pyNES into 0.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
gutomaia committed Jan 21, 2017
2 parents bac2abb + 475ede0 commit cbace7d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions pynes/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def __len__(self):
def size(self):
return 0

def __getitem__(self, index):
return self.get(index)

def get(self, index):
return self.instructions[index]

Expand Down
16 changes: 8 additions & 8 deletions pynes/tests/asm_block_operation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def test_immediate_proxy_plus_one_plus_single_proxy_return_asmblock_with_two_ins
expression = LDA + 1 + CLC
self.assert_type(expression, 'AsmBlock')
self.assertEquals(len(expression), 2)
self.assert_type(expression.get(0), 'Instruction', 'LDA')
self.assert_type(expression.get(1), 'Instruction', 'CLC')
self.assert_type(expression[0], 'Instruction', 'LDA')
self.assert_type(expression[1], 'Instruction', 'CLC')
actual = str(expression)
expected = '\n'.join([
'LDA #1',
Expand All @@ -39,17 +39,17 @@ def test_immediate_proxy_plus_one_plus_single_proxy_plus_immediate_proxy_return_
expression = LDA + 1 + CLC + ADC
self.assert_type(expression, 'AsmBlock')
self.assertEquals(len(expression), 3)
self.assert_type(expression.get(0), 'Instruction', 'LDA')
self.assert_type(expression.get(1), 'Instruction', 'CLC')
self.assert_type(expression.get(2), 'InstructionProxy', 'ADC')
self.assert_type(expression[0], 'Instruction', 'LDA')
self.assert_type(expression[1], 'Instruction', 'CLC')
self.assert_type(expression[2], 'InstructionProxy', 'ADC')

def test_complete_sum(self):
expression = LDA + 1 + CLC + ADC + 1
self.assert_type(expression, 'AsmBlock')
self.assertEquals(len(expression), 3)
self.assert_type(expression.get(0), 'Instruction', 'LDA', 'imm')
self.assert_type(expression.get(1), 'Instruction', 'CLC', 'sngl')
self.assert_type(expression.get(2), 'Instruction', 'ADC', 'imm')
self.assert_type(expression[0], 'Instruction', 'LDA', 'imm')
self.assert_type(expression[1], 'Instruction', 'CLC', 'sngl')
self.assert_type(expression[2], 'Instruction', 'ADC', 'imm')
actual = str(expression)
expected = '\n'.join([
'LDA #1',
Expand Down

0 comments on commit cbace7d

Please sign in to comment.