Skip to content
Snippets Groups Projects
Commit eaf62009 authored by Thomas Purcell's avatar Thomas Purcell
Browse files

Modify googletests to use ModelNode/FeatureNode properly

parent 2c4240f7
No related branches found
No related tags found
No related merge requests found
......@@ -34,9 +34,9 @@ namespace
TEST_F(ModelNodeTest, ConstructorTest)
{
node_ptr feat_1 = std::make_shared<ModelNode>(0, 1, "A", "$A$", "0", _value_1, _test_value_1, std::vector<std::string>(1, "A"), Unit("m"));
node_ptr feat_2 = std::make_shared<ModelNode>(1, 1, "B", "$B$", "1", _value_2, _test_value_2, std::vector<std::string>(1, "B"), Unit());
node_ptr feat_3 = std::make_shared<ModelNode>(2, 1, "C", "$C$", "2", _value_3, _test_value_3, std::vector<std::string>(1, "C"), Unit("m"));
std::shared_ptr<ModelNode> feat_1 = std::make_shared<ModelNode>(0, 1, "A", "$A$", "0", _value_1, _test_value_1, std::vector<std::string>(1, "A"), Unit("m"));
std::shared_ptr<ModelNode> feat_2 = std::make_shared<ModelNode>(1, 1, "B", "$B$", "1", _value_2, _test_value_2, std::vector<std::string>(1, "B"), Unit());
std::shared_ptr<ModelNode> feat_3 = std::make_shared<ModelNode>(2, 1, "C", "$C$", "2", _value_3, _test_value_3, std::vector<std::string>(1, "C"), Unit("m"));
EXPECT_FALSE(feat_1->is_const());
EXPECT_FALSE(feat_1->is_nan());
......
......@@ -13,9 +13,9 @@ namespace {
std::vector<double> scores = {0.9897782665572893};
std::vector<node_ptr> selected(1);
selected[0] = std::make_shared<ModelNode>(0, 0, "A", "$A$", "0", val_3, std::vector<double>(), std::vector<std::string>(1, "A"), Unit());
node_value_arrs::initialize_values_arr(4, 0, 1, 0);
selected[0] = std::make_shared<FeatureNode>(0, "A", val_3, std::vector<double>(), Unit());
node_value_arrs::initialize_d_matrix_arr();
node_value_arrs::resize_d_matrix_arr(1);
......
......@@ -7,13 +7,14 @@ namespace {
//test mean calculations
TEST(Project, ProjectTest)
{
node_value_arrs::initialize_values_arr(4, 0, 1, 0);
std::vector<double> prop = {1.0, 3.0, 5.0, 6.0};
std::vector<double> prop_class = {0.0, 0.0, 0.0, 1.0};
std::vector<double> val = {2.0, 2.0, 3.0, 4.0};
std::vector<double> scores(1, 0.0);
std::vector<int> sizes(1, 4);
std::vector<node_ptr> phi = {std::make_shared<ModelNode>(0, 0, "A", "$A$", "0", val, std::vector<double>(), std::vector<std::string>(1, "A"), Unit())};
std::vector<node_ptr> phi = {std::make_shared<FeatureNode>(0, "A", val, std::vector<double>(), Unit())};
project_funcs::project_r(prop.data(), scores.data(), phi, sizes, 1);
EXPECT_LT(std::abs(-0.9028289727756884 - scores[0]), 1e-10);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment