Sketcher: Add gtest unit test framework

This commit is contained in:
Chris Hennes
2023-04-19 22:21:41 -05:00
committed by abdullahtahiriyo
parent 069b5859e0
commit 22d8c8f0dd
7 changed files with 78 additions and 2 deletions

View File

@@ -24,6 +24,7 @@
#define PLANEGCS_CONSTRAINTS_H
#include "Geo.h"
#include "../../SketcherGlobal.h"
//#define _GCS_EXTRACT_SOLVER_SUBSYSTEM_ // This enables debugging code intended to extract information to file bug reports against Eigen, not for production code
@@ -96,7 +97,7 @@ namespace GCS
HyperbolaNegativeMinorY = 17
};
class Constraint
class SketcherExport Constraint
{
public:

View File

@@ -26,6 +26,7 @@
#include <Eigen/QR>
#include "SubSystem.h"
#include "../../SketcherGlobal.h"
#define EIGEN_VERSION (EIGEN_WORLD_VERSION * 10000 \
@@ -98,7 +99,7 @@ namespace GCS
DefaultTemporaryConstraint = -1
};
class System
class SketcherExport System
{
// This is the main class. It holds all constraints and information
// about partitioning into subsystems and solution strategies
@@ -449,6 +450,18 @@ namespace GCS
}
void invalidatedDiagnosis();
// Unit testing interface - not intended for use by production code
protected:
size_t _getNumberOfConstraints(int tagID = -1)
{
if (tagID < 0) {
return clist.size();
}
return std::count_if(clist.begin(), clist.end(), [tagID](Constraint* constraint) {
return constraint->getTag() == tagID;
});
}
};