Skip to content

Upgrade regression tests to openscad-test framework#1942

Merged
revarbat merged 9 commits intomasterfrom
testing_upgrade
Mar 17, 2026
Merged

Upgrade regression tests to openscad-test framework#1942
revarbat merged 9 commits intomasterfrom
testing_upgrade

Conversation

@revarbat
Copy link
Copy Markdown
Collaborator

@revarbat revarbat commented Mar 16, 2026

Summary

  • Replace all tests/test_*.scad files with tests/test_*.scadtest files using the openscad-test framework (requires openscad-test >= 1.0.3)
  • Each .scadtest file contains one [[test]] entry per test module, with inline OpenSCAD scripts using include <../std.scad> (resolved relative to tests/)
  • Add expect_success = false error tests to verify assertion failures on invalid inputs
  • Fix misplaced tests to match their source .scad files (per func_coverage.py)
  • Add new tests for previously uncovered functions, improving coverage from 55.6% → 62.7%
  • Fix bug: f_is_patch() in fnliterals.scad called non-existent is_patch() — corrected to is_bezier_patch() and renamed to f_is_bezier_patch()
  • Rewrite scripts/run_tests.sh to use openscad-test
  • Update CI (main.yml) Regressions job to install and use openscad-test
  • Update scripts/func_coverage.py to read test names from .scadtest files
  • Add TESTING.md documenting how to run and write tests
  • Add tests/tmp*.scad to .gitignore (runner temp files)

573 of 573 tests pass.

Test plan

  • Run openscad-test tests/test_*.scadtest — 573/573 pass
  • Run scripts/run_tests.sh — 573/573 pass
  • Run python3 scripts/func_coverage.py — no placement warnings
  • Verify CI Regressions job passes on this PR

🤖 Generated with Claude Code

revarbat and others added 9 commits March 16, 2026 14:03
Creates one .scadtest file per test_*.scad file, with individual
[[test]] entries per test module using inline scripts. Requires
openscad-test >= 1.0.3 and the BOSL2 venv.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove tests/test_*.scad (replaced by tests/test_*.scadtest)
- Rewrite scripts/run_tests.sh to use openscad-test
- Add pip install openscad-test step to Regressions CI job
- Remove OPENSCADPATH export (no longer needed with relative includes)
- Update scripts/func_coverage.py to read test names from .scadtest files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Explains requirements, how to run tests, and how to write new
tests using the .scadtest format.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Each error test uses expect_success = false to confirm that calling
a function or module with invalid arguments triggers an OpenSCAD
assertion error. Tests added to:
- test_math: lerp, factorial, gcd, lcm
- test_lists: reverse, list_rotate, select
- test_transforms: left, move
- test_strings: substr, str_replace_char
- test_vectors: unit, vector_angle
- test_linalg: transpose, outer_product

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Move test_hsl, test_hsv from test_miscellaneous to new test_color
  (hsl/hsv are defined in color.scad)
- Rename test_masks2d to test_masks (functions are in masks.scad)
- Move test_count from test_lists to test_math (count is in math.scad)
- Move test_all_integer, test_u_add/sub/mul/div, test_any, test_all
  from test_math to test_utility (all defined in utility.scad)

func_coverage.py now produces no placement warnings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
New tests added across 12 files:
- test_strings: rand_str
- test_lists: is_homogenous, list, permutations
- test_vectors: v_round, vector_bisect, vector_perp, fit_to_box
- test_transforms: xmove, ymove, zmove, tilt
- test_math: lerpn, bilerp, fit_to_range, slerp, slerpn
- test_geometry: are_polygons_equal, circle_circle_intersection,
  circle_line_intersection, sphere_line_intersection
- test_comparisons: unique_approx, unique_approx_indexed, list_smallest
- test_linalg: det4, is_matrix_symmetric, is_rotation, linear_solve3,
  rot_inverse
- test_utility: is_bool_list, is_func
- test_fnliterals: f_2arg_simple, f_is_function, f_is_range, f_is_vector,
  f_is_vnf, f_is_region, find_all, hashmap
- test_trigonometry: law_of_cosines, law_of_sines, all 17 right-triangle
  helper functions
- test_constants (new): get_slop, EDGE, FACE

Note: f_is_patch omitted — f_is_patch() references non-existent is_patch()
(should be is_bezier_patch), a bug in fnliterals.scad.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
is_patch() does not exist; the correct function is is_bezier_patch()
from beziers.scad. Also update the doc comment and restore the
test_f_is_patch test (which now requires including beziers.scad).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Consistent with the underlying is_bezier_patch() function name.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The runner writes inline scripts to the tests/ directory as tmp*.scad
files. These are normally deleted after each test, but can be left
behind if a test run is interrupted.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@revarbat revarbat merged commit 9defca5 into master Mar 17, 2026
3 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