#include #include #include #include #include "KDB.h" #include "platformUtils.h" TEST_CASE("Test Bayesian Network") { auto [Xd, y, features, className, states] = loadFile("iris"); SECTION("Test get features") { auto net = bayesnet::Network(); net.addNode("A"); net.addNode("B"); REQUIRE(net.getFeatures() == vector{"A", "B"}); net.addNode("C"); REQUIRE(net.getFeatures() == vector{"A", "B", "C"}); } SECTION("Test get edges") { auto net = bayesnet::Network(); net.addNode("A"); net.addNode("B"); net.addNode("C"); net.addEdge("A", "B"); net.addEdge("B", "C"); REQUIRE(net.getEdges() == vector>{ {"A", "B"}, { "B", "C" } }); net.addEdge("A", "C"); REQUIRE(net.getEdges() == vector>{ {"A", "B"}, { "A", "C" }, { "B", "C" } }); } }