Upgrade regression tests to openscad-test framework#1942
Merged
Conversation
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>
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.
Summary
tests/test_*.scadfiles withtests/test_*.scadtestfiles using theopenscad-testframework (requiresopenscad-test >= 1.0.3).scadtestfile contains one[[test]]entry per test module, with inline OpenSCAD scripts usinginclude <../std.scad>(resolved relative totests/)expect_success = falseerror tests to verify assertion failures on invalid inputs.scadfiles (perfunc_coverage.py)f_is_patch()infnliterals.scadcalled non-existentis_patch()— corrected tois_bezier_patch()and renamed tof_is_bezier_patch()scripts/run_tests.shto useopenscad-testmain.yml) Regressions job to install and useopenscad-testscripts/func_coverage.pyto read test names from.scadtestfilesTESTING.mddocumenting how to run and write teststests/tmp*.scadto.gitignore(runner temp files)573 of 573 tests pass.
Test plan
openscad-test tests/test_*.scadtest— 573/573 passscripts/run_tests.sh— 573/573 passpython3 scripts/func_coverage.py— no placement warnings🤖 Generated with Claude Code