-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from craigthomas/audio-mnemonic
Add AUDIO mnemonic and processing
- Loading branch information
Showing
6 changed files
with
136 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
name: Build Test Coverage | ||
on: [push, pull_request] | ||
on: [pull_request, workflow_dispatch] | ||
jobs: | ||
run: | ||
runs-on: ubuntu-20.04 | ||
env: | ||
OS: ubuntu-20.04 | ||
PYTHON: '3.8.10' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Python | ||
- name: Setup Python 3.8.12 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8.10 | ||
python-version: '3.8.12' | ||
- name: Update PIP | ||
run: python -m pip install --upgrade pip | ||
- name: Install Requirements | ||
run: pip install -r requirements.txt | ||
- name: Generate Report | ||
run: | | ||
pip install -r requirements.txt | ||
coverage run -m unittest | ||
run: coverage run --source=chip8asm -m unittest | ||
- name: Codecov | ||
uses: codecov/codecov-action@v3.1.0 | ||
uses: codecov/codecov-action@v4.2.0 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
""" | ||
Copyright (C) 204 Craig Thomas | ||
This project uses an MIT style license - see LICENSE for details. | ||
A Chip 8 assembler - see the README.md file for details. | ||
""" | ||
# I M P O R T S ############################################################### | ||
|
||
import unittest | ||
|
||
from chip8asm.program import Program | ||
from chip8asm.statement import Statement | ||
|
||
# C L A S S E S ############################################################### | ||
|
||
|
||
class TestIntegration(unittest.TestCase): | ||
""" | ||
A test class for integration tests. | ||
""" | ||
def setUp(self): | ||
""" | ||
Common setup routines needed for all unit tests. | ||
""" | ||
pass | ||
|
||
@staticmethod | ||
def translate_statements(program): | ||
""" | ||
Given a program, translate the statements into machine code. | ||
""" | ||
program.translate_statements() | ||
program.set_addresses() | ||
program.fix_opcodes() | ||
return program | ||
|
||
def test_audio_mnemonic_translate_correct(self): | ||
program = Program() | ||
statement = Statement() | ||
statement.parse_line(" AUDIO ; audio statement") | ||
program.statements.append(statement) | ||
program = self.translate_statements(program) | ||
machine_code = program.generate_machine_code() | ||
self.assertEqual([0xF0, 0x02], machine_code) | ||
|
||
# E N D O F F I L E ####################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters