mirror of
https://github.com/RRZE-HPC/OSACA.git
synced 2025-12-15 16:40:05 +01:00
flake8 formatting
This commit is contained in:
@@ -6,8 +6,6 @@ Unit tests for x86 Intel assembly parser
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from pyparsing import ParseException
|
||||
|
||||
from osaca.parser import ParserX86Intel, InstructionForm
|
||||
from osaca.parser.directive import DirectiveOperand
|
||||
from osaca.parser.identifier import IdentifierOperand
|
||||
@@ -134,13 +132,13 @@ class TestParserX86Intel(unittest.TestCase):
|
||||
self.assertEqual(parsed_4.mnemonic, "mov")
|
||||
self.assertEqual(parsed_4.operands[0],
|
||||
RegisterOperand(name="EAX"))
|
||||
self.assertEqual(parsed_4.operands[1],
|
||||
MemoryOperand(offset=ImmediateOperand(
|
||||
identifier="cur_elements$",
|
||||
value=104
|
||||
),
|
||||
base=RegisterOperand(name="RBP")))
|
||||
|
||||
self.assertEqual(
|
||||
parsed_4.operands[1],
|
||||
MemoryOperand(
|
||||
offset=ImmediateOperand(identifier="cur_elements$", value=104),
|
||||
base=RegisterOperand(name="RBP")
|
||||
)
|
||||
)
|
||||
self.assertEqual(parsed_5.mnemonic, "mov")
|
||||
self.assertEqual(parsed_5.operands[0],
|
||||
MemoryOperand(offset=ImmediateOperand(value=24),
|
||||
@@ -252,18 +250,21 @@ class TestParserX86Intel(unittest.TestCase):
|
||||
self.assertEqual(parsed[0].line_number, 1)
|
||||
# Check specifically that the values of the symbols defined by "=" were correctly
|
||||
# propagated.
|
||||
self.assertEqual(parsed[69],
|
||||
InstructionForm(mnemonic="mov",
|
||||
operands=[MemoryOperand(
|
||||
base=RegisterOperand("RBP"),
|
||||
offset=ImmediateOperand(
|
||||
value=4,
|
||||
identifier="r$1"
|
||||
)
|
||||
),
|
||||
ImmediateOperand(value=0)],
|
||||
line="\tmov\tDWORD PTR r$1[rbp], 0",
|
||||
line_number=73))
|
||||
self.assertEqual(
|
||||
parsed[69],
|
||||
InstructionForm(
|
||||
mnemonic="mov",
|
||||
operands=[
|
||||
MemoryOperand(
|
||||
base=RegisterOperand("RBP"),
|
||||
offset=ImmediateOperand(value=4, identifier="r$1")
|
||||
),
|
||||
ImmediateOperand(value=0)
|
||||
],
|
||||
line="\tmov\tDWORD PTR r$1[rbp], 0",
|
||||
line_number=73
|
||||
)
|
||||
)
|
||||
# Check a few lines to make sure that we produced something reasonable.
|
||||
self.assertEqual(parsed[60],
|
||||
InstructionForm(mnemonic="mov",
|
||||
|
||||
@@ -314,11 +314,11 @@ class TestSemanticTools(unittest.TestCase):
|
||||
|
||||
def test_src_dst_assignment_x86_intel(self):
|
||||
for instruction_form in self.kernel_x86_intel:
|
||||
with self.subTest(instruction_form=instruction_form):
|
||||
if instruction_form.semantic_operands is not None:
|
||||
self.assertTrue("source" in instruction_form.semantic_operands)
|
||||
self.assertTrue("destination" in instruction_form.semantic_operands)
|
||||
self.assertTrue("src_dst" in instruction_form.semantic_operands)
|
||||
with self.subTest(instruction_form=instruction_form):
|
||||
if instruction_form.semantic_operands is not None:
|
||||
self.assertTrue("source" in instruction_form.semantic_operands)
|
||||
self.assertTrue("destination" in instruction_form.semantic_operands)
|
||||
self.assertTrue("src_dst" in instruction_form.semantic_operands)
|
||||
|
||||
def test_src_dst_assignment_AArch64(self):
|
||||
for instruction_form in self.kernel_AArch64:
|
||||
|
||||
Reference in New Issue
Block a user