1#include "DecisionForestRuntimeTest.h"
2#include "decision_forest_model/CategoricalFeature.h"
3#include "gtest/gtest.h"
4
5namespace clang {
6namespace clangd {
7
8TEST(DecisionForestRuntime, Evaluate) {
9 using Example = ::ns1::ns2::test::Example;
10 using Cat = ::ns1::ns2::TestEnum;
11 using ::ns1::ns2::test::Evaluate;
12
13 Example E;
14 E.setANumber(200); // True
15 E.setAFloat(0); // True: +10.0
16 E.setACategorical(Cat::A); // True: +5.0
17 EXPECT_EQ(Evaluate(E), 15.0);
18
19 E.setANumber(200); // True
20 E.setAFloat(-2.5); // False: -20.0
21 E.setACategorical(Cat::B); // True: +5.0
22 EXPECT_EQ(Evaluate(E), -15.0);
23
24 E.setANumber(100); // False
25 E.setACategorical(Cat::C); // True: +3.0, False: -6.0
26 EXPECT_EQ(Evaluate(E), -3.0);
27}
28} // namespace clangd
29} // namespace clang
30

source code of clang-tools-extra/clangd/unittests/DecisionForestTests.cpp