Repository navigation
test(compiler): achieve 100% test coverage for compiler.py - #51
Merged
Merged
Conversation
- Add ~ operator to Lexer.TOKEN_SPEC OP pattern to match unary bitwise NOT - Add unit tests for constant folding across all binary and unary operators - Add unit tests for parser consume and statement syntax errors - Add unit tests for global variables and arrays (auto-sizing and syntax errors) - Add unit tests for for-loop inline variations (omitted init, compound assign, expressions) - Add unit tests for character literal escape sequences and unknown escape fallback - Add unit tests for runtime codegen of unary, bitwise, and logical operators - Add unit tests for peephole optimization rules 3 and 5 - Add unit tests for hardware builtins (vram_clear, in, out, and >4 function call arguments) - Add unit tests for RAM allocation boundary (VRAM skip) and high RAM addresses (>= 256) - Add unit tests for compile_c_file and compile_c_file_with_symbols
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Achieved 100% statement coverage for
src/tiny8/compiler.py(321 total test suite passing):Lexer.TOKEN_SPECby adding the~operator to the OP token pattern so that unary bitwise NOT expressions can be tokenized properly.tests/test_compiler.py:\n,\t,\0,\\,\') and unknown escape fallback.-,~,!), bitwise, and logical operators on variables.vram_clear,in,out) and function calls with > 4 arguments.R31high-byte pointer manipulation and VRAM skip boundary (0x0200..0x05FF).compile_c_fileandcompile_c_file_with_symbols.How tested
uv run pytest --cov=tiny8.compiler --cov-report=term-missing:src/tiny8/compiler.py: 1165/1165 statements, 100% coverage (0 missing lines).uv run ruff check src/tiny8/compiler.py tests/test_compiler.py: passed.uv run ruff format --check src/tiny8/compiler.py tests/test_compiler.py: passed.