#include #include #include #include #include "../src/KDB.h" #include "utils.h" TEST_CASE("Test Bayesian Network") { auto[Xd, y, features, className, states] = loadFile("iris"); SECTION("Test Update Nodes") { auto net = bayesnet::Network(); net.addNode("A", 3); REQUIRE(net.getStates() == 3); net.addNode("A", 5); REQUIRE(net.getStates() == 5); } SECTION("Test get features") { auto net = bayesnet::Network(); net.addNode("A", 3); net.addNode("B", 5); REQUIRE(net.getFeatures() == vector{"A", "B"}); net.addNode("C", 2); REQUIRE(net.getFeatures() == vector{"A", "B", "C"}); } }