test(tests/network): added test to play with reaclib (temporary)

this test will eventually move to its own test class
This commit is contained in:
2025-06-18 15:25:41 -04:00
parent 3b21883e97
commit df9f1cebce

View File

@@ -5,9 +5,13 @@
#include "config.h" #include "config.h"
#include "network.h" #include "network.h"
#include "composition.h" #include "composition.h"
#include "reaclib.h"
#include "reactions.h"
#include <vector> #include <vector>
#include "reactions.h"
std::string TEST_CONFIG = std::string(getenv("MESON_SOURCE_ROOT")) + "/tests/testsConfig.yaml"; std::string TEST_CONFIG = std::string(getenv("MESON_SOURCE_ROOT")) + "/tests/testsConfig.yaml";
class approx8Test : public ::testing::Test {}; class approx8Test : public ::testing::Test {};
@@ -61,3 +65,17 @@ TEST_F(approx8Test, evaluate) {
EXPECT_NEAR(He4MassFraction, 1.0, relError); EXPECT_NEAR(He4MassFraction, 1.0, relError);
EXPECT_NEAR(energyFraction, 1.0, relError); EXPECT_NEAR(energyFraction, 1.0, relError);
} }
TEST_F(approx8Test, reaclib) {
using namespace serif::network;
const std::vector<double> comp = {0.708, 2.94e-5, 0.276, 0.003, 0.0011, 9.62e-3, 1.62e-3, 5.16e-4};
const std::vector<std::string> symbols = {"H-1", "He-3", "He-4", "C-12", "N-14", "O-16", "Ne-20", "Mg-24"};
serif::composition::Composition composition;
composition.registerSymbol(symbols, true);
composition.setMassFraction(symbols, comp);
bool isFinalized = composition.finalize(true);
reaclib::REACLIBReactionSet reactionSet = build_reaclib_nuclear_network(composition);
std::cout << reactionSet.size() << std::endl;
}