apeltauer wrote: ↑
Fri Aug 11, 2017 2:36 pm
@ezzieyguywuf i am interested in how you are realizing the unit tests in c++. What framework are you using?
I have no clue how a unit test with c++ should look like for FreeCAD. I would try to use gtest, but i dont know what the commen way in FreeCAD is...
I have made some small progress on this. You can see my work here on my github
. You'll want to start with SolidManager_PrimitiveTester.cpp
which shows some very basic tests for the Topological Namer that I'm working on.
You'll also want to take a look at IEdge.h, IFace.h, and ISolid.h. These three header files describe a generic interface to a topological Edge, Face, and Solid respectively. The idea is that my Topological Namer (and really, any component within FreeCAD in general) does not need to know specifically about TopoDS_Edge, TopoDS_Face, nor TopoDS_Solid from OpenCascade. Rather, what the Topological Namer needs to know is about an interface to these entities.
So, what I have right now is a very very basic interface for these - essentially, only exposing the functionality that I need for a basic Topological Namer test. You'll notice in my test/include folder I've defined some classes (i.e. Mock_Edge.h) which implement these headers. These 'mock' classes implement the respective interfaces in a very naive manner: for example, for checking equality they accept an integer to identify themselves and check if this value is equal. This works well for my basic tests - you can see how I use these mock classes in the MockObjectMaker helper class.
Anywho, hopefully this helps a little bit. Let me know if you have any questions, I haven't really gotten around to documenting this code yet.