Skip to content

test(parser): cover scalar rvalues, block comments and COND text - #14

Merged
KelvinChung2000 merged 1 commit into
masterfrom
test/parser-regression-coverage
Sep 17, 2026
Merged

KelvinChung2000 merged 1 commit into
masterfrom
test/parser-regression-coverage

Conversation

@KelvinChung2000

@KelvinChung2000 KelvinChung2000 commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

#11 and #12 landed without tests. These pin the behaviour they restored, in the classes that already name it.

  • tests/test_transformers.py::TestSingleFloatRvalue — scalar rvalue in a delay and in a timing check, plus the round-trip that catches a scalar reaching only typ ((:5.0:), which drops the entry from critical-path and stats). () and the full triple are in the same parametrize as non-regression cases. The class previously parsed spec-example1.sdf, which contains no scalar rvalue, and asserted only that cells existed.
  • tests/test_transformers.py::TestConditionalDelays and ::TestCondTimingChecks — COND text on both grammar paths (cond_delay and the timing_port COND), over 1'b0, 'b1, 0, 1.5, -1, 1e3 and a && chain, and on emit. One case asserts delay values after a condition still parse as floats.
  • tests/test_parser.py::TestParseFile — block comments before (DELAYFILE, multi-line, trailing, and two on one line to show the non-greedy match does not swallow the text between them.

Checked against the parent commits: 31 of the 64 tests in the two files fail on 0f27091^, 18 on 2f8afbd^.

The fixes in #11 and #12 landed without tests, so nothing pins the
behaviour they restored. The cases go into the classes that already
name the behaviour: TestSingleFloatRvalue, which until now parsed a
file containing no scalar rvalue and asserted only that cells existed,
TestConditionalDelays and TestCondTimingChecks.

Scalar rvalues are checked in both a delay and a timing check position,
since rvalue is shared, and the empty and triple forms sit in the same
parametrize as non-regression cases. The round-trip assertion is what
catches a scalar reaching only typ, which emits as (:5.0:) and drops the
entry from critical-path and stats reporting.

COND text is checked on both grammar paths, cond_delay and the
timing_port COND, over scalar constants with and without a leading
digit, plain integers, decimals, signed and exponent literals. One case
asserts the delay values following a condition still parse as floats,
which is what the contextual lexer is relied on for.
@KelvinChung2000
KelvinChung2000 force-pushed the test/parser-regression-coverage branch from f4814c4 to 2603ec5 Compare September 17, 2026 08:27
@KelvinChung2000
KelvinChung2000 merged commit 4cab98f into master Sep 17, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant