ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
ppforest2::test Namespace Reference

Classes

class  MockStop
 Mock StopRule whose verdict is fixed at construction time. More...
 
struct  NodeContextFixture
 Test-only fixture that owns the storage backing a NodeContext. More...
 

Functions

pp::Projector as_projector (std::vector< types::Feature > v)
 Build a Projector from a std::vector<Feature> initializer.
 
TrainingSpec::Ptr classification_spec ()
 Default-valued classification spec.
 
TrainingSpec::Ptr regression_spec ()
 Minimal well-formed regression spec.
 
inline ::testing::AssertionResult throws_with (std::function< void()> const &fn, std::string const &needle)
 gtest assertion: fn throws a std::runtime_error whose what() contains needle.
 

Function Documentation

◆ as_projector()

pp::Projector ppforest2::test::as_projector ( std::vector< types::Feature > v)
inline

Build a Projector from a std::vector<Feature> initializer.

Tests reach for projector vectors a lot — the Eigen::Map → Projector dance reads as line noise at the call site. This helper hides it so tests can write as_projector({1.0F, 0.0F}) and stay focused on the data their assertions depend on.

◆ classification_spec()

TrainingSpec::Ptr ppforest2::test::classification_spec ( )
inline

Default-valued classification spec.

◆ regression_spec()

TrainingSpec::Ptr ppforest2::test::regression_spec ( )
inline

Minimal well-formed regression spec.

Picks regression-compatible strategies (ByCutpoint, MeanResponse, MinSize) since the classification defaults (e.g., PureNode) reject regression mode at validation time.

◆ throws_with()

inline ::testing::AssertionResult ppforest2::test::throws_with ( std::function< void()> const & fn,
std::string const & needle )

gtest assertion: fn throws a std::runtime_error whose what() contains needle.

Used by JSON-validation tests where the exception message carries the dotted path of the offending field (e.g. "config.pp.lambda: missing required key"). Centralised here so JsonReader, ExportValidation, and per-strategy from_json tests share one helper.

EXPECT_TRUE(throws_with([&] { reader.require<int>("k"); }, "k: missing"));
inline ::testing::AssertionResult throws_with(std::function< void()> const &fn, std::string const &needle)
gtest assertion: fn throws a std::runtime_error whose what() contains needle.
Definition ThrowsWith.hpp:34