fix: tests failing

This commit is contained in:
2025-07-19 00:54:42 +01:00
parent 2d9b9e9c70
commit 67dc55dfb2
8 changed files with 72 additions and 66 deletions

View File

@@ -4,7 +4,7 @@
#include "Engine/Network/NetworkManager.h"
#include "Engine/Operator/GeometryOperator.h"
#include "Engine/Types.h"
#include "Engine/Operator/GOP_test.h"
#include "Engine/Operator/OperatorTable.h"
#include <iostream>
struct NMReset
@@ -20,13 +20,21 @@ struct NMReset
};
// TODO: fix this init monstrosity
struct OperatorTableInit
{
OperatorTableInit() { enzo::op::OperatorTable::initPlugins(); }
};
static OperatorTableInit _operatorTableInit;
auto testOpCtor = enzo::op::OperatorTable::getOpConstructor("house");
TEST_CASE_METHOD(NMReset, "Network Manager")
{
using namespace enzo;
auto& nm = nt::nm();
nt::OpId startOp = nm.addOperator(&GOP_test::ctor);
nt::OpId startOp = nm.addOperator(testOpCtor);
nt::OpId prevOp = startOp;
std::vector<nt::OpId> prevOps;
@@ -34,7 +42,7 @@ TEST_CASE_METHOD(NMReset, "Network Manager")
{
for(int i=0; i<4; ++i)
{
nt::OpId newOp = nm.addOperator(&GOP_test::ctor);
nt::OpId newOp = nm.addOperator(testOpCtor);
prevOps.push_back(newOp);
nt::connectOperators(newOp, i, prevOp, 0);
}
@@ -44,7 +52,7 @@ TEST_CASE_METHOD(NMReset, "Network Manager")
for(int i=0; i<size(prevOpsBuffer); ++i)
{
prevOps.clear();
nt::OpId newOp = nm.addOperator(GOP_test::ctor);
nt::OpId newOp = nm.addOperator(testOpCtor);
prevOps.push_back(newOp);
nt::connectOperators(newOp, 0, prevOpsBuffer[i], 0);

View File

@@ -3,8 +3,8 @@
#include <memory>
#include "Engine/Network/NetworkManager.h"
#include "Engine/Operator/GeometryOperator.h"
#include "Engine/Operator/OperatorTable.h"
#include "Engine/Types.h"
#include "Engine/Operator/GOP_test.h"
#include <iostream>
struct NMReset
@@ -20,12 +20,20 @@ struct NMReset
};
// TODO: fix this init monstrosity
struct OperatorTableInit
{
OperatorTableInit() { enzo::op::OperatorTable::initPlugins(); }
};
static OperatorTableInit _operatorTableInit;
auto testOpCtor = enzo::op::OperatorTable::getOpConstructor("house");
TEST_CASE_METHOD(NMReset, "network fixture separation start")
{
using namespace enzo;
auto& nm = nt::nm();
nt::OpId newOpId = nm.addOperator(GOP_test::ctor);
nt::OpId newOpId = nm.addOperator(testOpCtor);
REQUIRE(newOpId==1);
REQUIRE(nm.isValidOp(1));
@@ -45,8 +53,8 @@ TEST_CASE_METHOD(NMReset, "network")
using namespace enzo;
auto& nm = nt::nm();
nt::OpId newOpId = nm.addOperator(GOP_test::ctor);
nt::OpId newOpId2 = nm.addOperator(GOP_test::ctor);
nt::OpId newOpId = nm.addOperator(testOpCtor);
nt::OpId newOpId2 = nm.addOperator(testOpCtor);
REQUIRE(nm.isValidOp(newOpId));
if(nm.isValidOp(newOpId))
@@ -70,13 +78,13 @@ TEST_CASE_METHOD(NMReset, "reset")
using namespace enzo;
auto& nm = nt::nm();
nt::OpId newOpId = nm.addOperator(GOP_test::ctor);
nt::OpId newOpId = nm.addOperator(testOpCtor);
nm._reset();
REQUIRE_FALSE(nm.isValidOp(newOpId));
nt::OpId newOpId2 = nm.addOperator(GOP_test::ctor);
nt::OpId newOpId2 = nm.addOperator(testOpCtor);
REQUIRE(nm.isValidOp(newOpId2));

View File

@@ -20,25 +20,3 @@ TEST_CASE("tbb")
<< std::this_thread::get_id() << std::endl;
});
}
TEST_CASE("boost dll")
{
std::cout << "Using Boost "
<< BOOST_VERSION / 100000 << "." // major version
<< BOOST_VERSION / 100 % 1000 << "." // minor version
<< BOOST_VERSION % 100 // patch level
<< std::endl;
boost::shared_ptr<std::string> cpp_var = boost::dll::import_symbol<std::string>(
"build/src/OpDefs/libenzoOps1.so", "myVar"
);
std::cout << "VAR: " << *cpp_var << "\n";
auto cpp11_func = boost::dll::import_symbol<void(enzo::op::addOperatorPtr)>(
"build/src/OpDefs/libenzoOps1.so", "newSopOperator"
);
cpp11_func(enzo::op::OperatorTable::addOperator);
}