clang-tools  15.0.0git
DecisionForestTests.cpp
Go to the documentation of this file.
1 #include "DecisionForestRuntimeTest.h"
3 #include "gtest/gtest.h"
4 
5 namespace clang {
6 namespace clangd {
7 
8 TEST(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
clang::clangd::TEST
TEST(BackgroundQueueTest, Priority)
Definition: BackgroundIndexTests.cpp:750
E
const Expr * E
Definition: AvoidBindCheck.cpp:88
CategoricalFeature.h
ns1::ns2::A
@ A
Definition: CategoricalFeature.h:3
clang::pp_trace::Cat
static cl::OptionCategory Cat("pp-trace options")
ns1::ns2::TestEnum
TestEnum
Definition: CategoricalFeature.h:3
C
const Criteria C
Definition: FunctionCognitiveComplexityCheck.cpp:93
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
ns1::ns2::B
@ B
Definition: CategoricalFeature.h:3