Skip to content

Latest commit

 

History

History
86 lines (69 loc) · 3.89 KB

asm_tests.org

File metadata and controls

86 lines (69 loc) · 3.89 KB

GameBoy Python Tests

Press “C-c C-c” on the begin_src line below to execute the Python script. This will run the unit tests.

"""GameBoy assembler unit tests."""
import unittest
import os
import sys
from dmg_asm.tests.core_tests import ExpressionUnitTests, ConvertUnitTests, \
    DescriptorUnitTests, SymbolUnitTests
from dmg_asm.tests.assembler_tests import AssemblerUnitTests
from dmg_asm.tests.token_tests import TokenUnitTests
from dmg_asm.tests.directive_tests import DirectiveUnitTests
from dmg_asm.tests.symbol_label_resolver_tests import SymbolAndLabelUnitTests
from dmg_asm.tests.instruction_tests import InstructionDecodingTests
from dmg_asm.tests.ip_tests import IPUnitTests
from dmg_asm.tests.reader_tests import CoreReaderTests


os.environ["PROJECT_DIR"] = os.getcwd()

# ---------------------------------------------------------------
print("===== Instruction Decoding Unit Tests ==============")
loader = unittest.TestLoader()
suite = loader.loadTestsFromTestCase(InstructionDecodingTests)
unittest.TextTestRunner(stream=sys.stdout, verbosity=1).run(suite)

# ---------------------------------------------------------------
print("===== Descriptor Tests =============================")
loader = unittest.TestLoader()
suite = loader.loadTestsFromTestCase(DescriptorUnitTests)
unittest.TextTestRunner(stream=sys.stdout, verbosity=1).run(suite)

# ---------------------------------------------------------------
print("===== Expression Tests =============================")
loader = unittest.TestLoader()
suite = loader.loadTestsFromTestCase(ExpressionUnitTests)
unittest.TextTestRunner(stream=sys.stdout, verbosity=1).run(suite)

# ---------------------------------------------------------------
print("===== Conversion Unit Tests ========================")
suite = loader.loadTestsFromTestCase(ConvertUnitTests)
unittest.TextTestRunner(stream=sys.stdout, verbosity=1).run(suite)

# ---------------------------------------------------------------
print("===== Symbol Unit Tests ============================")
suite = loader.loadTestsFromTestCase(SymbolUnitTests)
unittest.TextTestRunner(stream=sys.stdout, verbosity=1).run(suite)

# ---------------------------------------------------------------
print("===== Token Unit Tests =============================")
suite = loader.loadTestsFromTestCase(TokenUnitTests)
unittest.TextTestRunner(stream=sys.stdout, verbosity=1).run(suite)

# ---------------------------------------------------------------
print("===== Directive Unit Tests =========================")
suite = loader.loadTestsFromTestCase(DirectiveUnitTests)
unittest.TextTestRunner(stream=sys.stdout, verbosity=1).run(suite)

# ---------------------------------------------------------------
print("===== Symbol and Label Unit Tests ==================")
suite = loader.loadTestsFromTestCase(SymbolAndLabelUnitTests)
unittest.TextTestRunner(stream=sys.stdout, verbosity=1).run(suite)

# ---------------------------------------------------------------
print("===== Instruction Pointer Tests ====================")
suite = loader.loadTestsFromTestCase(IPUnitTests)
unittest.TextTestRunner(stream=sys.stdout, verbosity=1).run(suite)

# ---------------------------------------------------------------
print("===== Core Reader Tests ===========================")
suite = loader.loadTestsFromTestCase(CoreReaderTests)
unittest.TextTestRunner(stream=sys.stdout, verbosity=1).run(suite)

# ---------------------------------------------------------------
print("===== Assembler Tests =============================")
suite = loader.loadTestsFromTestCase(AssemblerUnitTests)
unittest.TextTestRunner(stream=sys.stdout, verbosity=1).run(suite)