jbuckmccready / CavalierContours

2D polyline library for offsetting, combining, etc.
MIT License
421 stars 79 forks source link

Create Automated Tests #4

Closed jbuckmccready closed 4 years ago

jbuckmccready commented 4 years ago

Determine test framework to be used and create automated tests to cover as much of the library as possible. Google test is one possibility but it does not support property based testing out of the box, so I will look into some others.

Some of the functions that need tests are the following:

I would like to create discrete tests (known input and output), as well as property based tests (random but parameterized input with expected properties) to find numeric instabilities, or cases that might not be covered in the discrete tests. The generated data would include the following:

jbuckmccready commented 4 years ago

Settled on google test (found it the more ergonomic than Catch2 and easier to create parameterized tests). Added tests for C API cavc_pline type, and the basic functions: cavc_get_area, cavc_get_path_length, cavc_get_extents, cavc_get_closest_point, and cavc_get_winding_number. For the basic functions I implemented parameterized tests for simple axis aligned circles.

Added github actions that build and run tests on linux with gcc, windows with msvc, and macos with apple clang. Added additional compiler flags to set warnings set as build errors for CI.

Still to be done:

jbuckmccready commented 4 years ago

Added discrete tests to cavc_parallel_offset, see commit https://github.com/jbuckmccready/CavalierContours/commit/4bcfc46c488df958178218370778ef5e49c6e988.

jbuckmccready commented 4 years ago

Added tests for StaticSpatialIndex, see commit https://github.com/jbuckmccready/CavalierContours/commit/9d4023559581a601be6e61d60ce7fbca78bd6c06.

jbuckmccready commented 4 years ago

Added tests for cavc_combine_lines, see commit https://github.com/jbuckmccready/CavalierContours/commit/c69594d3bc455addf05f965b3acecd7df0d0e36e.

jbuckmccready commented 4 years ago

Closing this issue for now, infrastructure is now in place and many tests have been added. Will create specific issues for any new tests to be added.