brintos

brintos / llvm-project-archived public Read only

0
0
Text · 815 B · d29c8a4 Raw
30 lines · cpp
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);         // True15  E.setAFloat(0);            // True: +10.016  E.setACategorical(Cat::A); // True: +5.017  EXPECT_EQ(Evaluate(E), 15.0);18 19  E.setANumber(200);         // True20  E.setAFloat(-2.5);         // False: -20.021  E.setACategorical(Cat::B); // True: +5.022  EXPECT_EQ(Evaluate(E), -15.0);23 24  E.setANumber(100);         // False25  E.setACategorical(Cat::C); // True: +3.0, False: -6.026  EXPECT_EQ(Evaluate(E), -3.0);27}28} // namespace clangd29} // namespace clang30