mirror of
https://github.com/Doctorado-ML/FImdlp.git
synced 2025-08-18 08:55:51 +00:00
Complete CPP tests
This commit is contained in:
2
Makefile
2
Makefile
@@ -6,6 +6,8 @@ clean: ## Clean up
|
|||||||
rm -rf build dist *.egg-info
|
rm -rf build dist *.egg-info
|
||||||
if [ -f fimdlp/cfimdlp.cpp ]; then rm fimdlp/cfimdlp.cpp; fi;
|
if [ -f fimdlp/cfimdlp.cpp ]; then rm fimdlp/cfimdlp.cpp; fi;
|
||||||
if [ -f fimdlp/cppfimdlp.cpython-310-darwin.so ]; then rm fimdlp/cppfimdlp.cpython-310-darwin.so; fi;
|
if [ -f fimdlp/cppfimdlp.cpython-310-darwin.so ]; then rm fimdlp/cppfimdlp.cpython-310-darwin.so; fi;
|
||||||
|
if [ -d fimdlp/testcpp/build ]; then rm -fr fimdlp/testcpp/build/* ; fi;
|
||||||
|
if [ -d fimdlp/testcpp/lcoverage ]; then rm -fr fimdlp/testcpp/lcoverage/* ; fi;
|
||||||
|
|
||||||
test:
|
test:
|
||||||
cd fimdlp/testcpp && ./test
|
cd fimdlp/testcpp && ./test
|
||||||
|
@@ -267,8 +267,4 @@ namespace mdlp {
|
|||||||
{
|
{
|
||||||
cutPoints = cutPoints_;
|
cutPoints = cutPoints_;
|
||||||
}
|
}
|
||||||
indices_t CPPFImdlp::getIndices()
|
|
||||||
{
|
|
||||||
return indices;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@@ -13,6 +13,10 @@ namespace mdlp {
|
|||||||
y = { 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 };
|
y = { 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 };
|
||||||
fit(X, y);
|
fit(X, y);
|
||||||
}
|
}
|
||||||
|
void setProposal(bool value)
|
||||||
|
{
|
||||||
|
proposal = value;
|
||||||
|
}
|
||||||
void initCutPoints()
|
void initCutPoints()
|
||||||
{
|
{
|
||||||
setCutPoints(cutPoints_t());
|
setCutPoints(cutPoints_t());
|
||||||
@@ -150,4 +154,24 @@ namespace mdlp {
|
|||||||
computed = getCutPoints();
|
computed = getCutPoints();
|
||||||
checkVectors(expected, computed);
|
checkVectors(expected, computed);
|
||||||
}
|
}
|
||||||
|
TEST_F(TestFImdlp, Constructor)
|
||||||
|
{
|
||||||
|
samples X = { 5.7, 5.3, 5.2, 5.1, 5.0, 5.6, 5.1, 6.0, 5.1, 5.9 };
|
||||||
|
labels y = { 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 };
|
||||||
|
setProposal(false);
|
||||||
|
fit(X, y);
|
||||||
|
computeCutPointsOriginal();
|
||||||
|
cutPoints_t expected;
|
||||||
|
vector<float> computed = getCutPoints();
|
||||||
|
expected = {
|
||||||
|
{ 0, 4, -1, -3.4028234663852886e+38, 5.15 }, { 4, 6, -1, 5.15, 5.45 },
|
||||||
|
{ 6, 10, -1, 5.45, 3.4028234663852886e+38 }
|
||||||
|
};
|
||||||
|
computed = getCutPoints();
|
||||||
|
int expectedSize = expected.size();
|
||||||
|
EXPECT_EQ(computed.size(), expected.size());
|
||||||
|
for (auto i = 0; i < expectedSize; i++) {
|
||||||
|
EXPECT_NEAR(computed[i], expected[i].toValue, .00000001);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user