Skip to content

Commit

Permalink
Fix other errors inside BaggingMachine/RandomForest unit tests.
Browse files Browse the repository at this point in the history
* Override create_empty() of CMockFeatures and CMockLabels;
  • Loading branch information
geektoni committed May 31, 2019
1 parent bf07d67 commit fe8419a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions tests/unit/features/MockFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ namespace shogun {
MOCK_CONST_METHOD0(get_num_vectors, int32_t());

virtual const char* get_name() const { return "MockCFeatures"; }

protected:
virtual CSGObject *create_empty() const
{
auto copy = new MockCFeatures();
SG_REF(copy)
return copy;
};
};

} // namespace shogun
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/labels/MockLabels.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ namespace shogun {
MOCK_METHOD0(get_values, SGVector<float64_t>());

virtual const char* get_name() const { return "MockCLabels"; }

protected:
virtual CSGObject *create_empty() const
{
auto copy = new MockCLabels();
SG_REF(copy)
return copy;
};
};

} // namespace shogun
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/multiclass/BaggingMachine_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ TEST_F(BaggingMachine, mock_train)
bm->parallel->set_num_threads(1);
bm->put<CMachine>("machine", bm);
bm->put<int32_t>("bag_size", bag_size);
bm->put<int32_t>("num_bag", num_bags);
bm->put<int32_t>("num_bags", num_bags);
bm->put<CCombinationRule>("combination_rule", dynamic_cast<CCombinationRule*>(mv));

ON_CALL(mm, train_machine(_))
Expand Down

0 comments on commit fe8419a

Please sign in to comment.