#include #include "config.h" #include "eosIO.h" #include "helm.h" #include "resourceManager.h" #include "resourceManagerTypes.h" #include #include #include #include #include "debug.h" /** * @file configTest.cpp * @brief Unit tests for the resourceManager class. */ std::string TEST_CONFIG = std::string(getenv("MESON_SOURCE_ROOT")) + "/tests/testsConfig.yaml"; /** * @brief Test suite for the resourceManager class. */ class resourceManagerTest : public ::testing::Test {}; /** * @brief Test the constructor of the resourceManager class. */ TEST_F(resourceManagerTest, constructor) { Config::getInstance().loadConfig(TEST_CONFIG); EXPECT_NO_THROW(ResourceManager::getInstance()); } TEST_F(resourceManagerTest, getAvaliableResources) { Config::getInstance().loadConfig(TEST_CONFIG); ResourceManager& rm = ResourceManager::getInstance(); std::vector resources = rm.getAvaliableResources(); std::set expected = {"eos:helm", "mesh:sphere"}; std::set actual(resources.begin(), resources.end()); EXPECT_EQ(expected, actual); } TEST_F(resourceManagerTest, getResource) { Config::getInstance().loadConfig(TEST_CONFIG); ResourceManager& rm = ResourceManager::getInstance(); std::string name = "eos:helm"; const Resource &r = rm.getResource(name); // BREAKPOINT(); const auto &eos = std::get>(r); EXPECT_EQ("helm", eos->getFormat()); EOSTable &table = eos->getTable(); // -- Extract the Helm table from the EOSTable helmholtz::HELMTable &helmTable = *std::get>(table); EXPECT_DOUBLE_EQ(helmTable.f[0][0], -1692098915534.8142); EXPECT_THROW(rm.getResource("opac:GS98:high:doesNotExist"), std::runtime_error); }