manifold icon indicating copy to clipboard operation
manifold copied to clipboard

suggestion: fuzzing

Open pca006132 opened this issue 2 years ago • 3 comments

Perhaps we can use https://llvm.org/docs/LibFuzzer.html to test the library? Generate a number of primitive objects, perform random translation/scaling/rotation and boolean operations for them. There are a few things we can test for:

  1. Memory usage.
  2. Should not crash.
  3. Compare with other libraries like CGAL? Not sure about if this is possible.

pca006132 avatar May 11 '22 10:05 pca006132

That sounds pretty cool, but in my experience, I don't think random transforms will be enough. The ugly edges cases have more to do with colinear/coplanar intersections and large, complex holes in individual faces. That's why I build the Menger Sponge test cases. I'm also working on an SDF implementation which will allow us to create random shapes more easily that will be guaranteed manifold and non-overlapping. Still, this framework sounds useful.

elalish avatar May 11 '22 15:05 elalish

A code coverage report at the very least would be very beneficial!

elalish avatar May 11 '22 15:05 elalish

The fuzzer will just give us an array of bytes, we will transform that into operations for geometric objects, so in principle we can favor generating colinear/coplanar/complex holes in addition to random transforms. Perhaps I can try to write a prototype for this later.

pca006132 avatar May 11 '22 16:05 pca006132

feel that we really need this for the triangulator, will look into this later.

pca006132 avatar Nov 12 '23 16:11 pca006132