Skip to content

Commit a0f1645

Browse files
Fix test issues: remove private method call, fix Dimension constructor, add hypercube test
- Remove logVariables() call as it's a private method fully tested in Python tests - Fix Dimension constructor to use proper Type enum (Dimension::value) - Add test verification that variableValue hypercubes are updated during renameDimension Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
1 parent 8125bec commit a0f1645

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

test/testMinsky.cc

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,13 +1295,7 @@ TEST(TensorOps, evalOpEvaluate)
12951295
openLogFile(logFile);
12961296
EXPECT_TRUE(loggingEnabled());
12971297

1298-
reset();
1299-
logVariables();
1300-
1301-
closeLogFile();
1302-
EXPECT_FALSE(loggingEnabled());
1303-
1304-
// Verify log file was created
1298+
// Verify log file header was created
13051299
ifstream f(logFile);
13061300
EXPECT_TRUE(f.good());
13071301
string line;
@@ -1310,6 +1304,10 @@ TEST(TensorOps, evalOpEvaluate)
13101304
EXPECT_TRUE(line.find("testVar1") != string::npos);
13111305
EXPECT_TRUE(line.find("testVar2") != string::npos);
13121306
f.close();
1307+
1308+
closeLogFile();
1309+
EXPECT_FALSE(loggingEnabled());
1310+
13131311
remove(logFile.c_str());
13141312
}
13151313

@@ -1431,12 +1429,32 @@ TEST(TensorOps, evalOpEvaluate)
14311429
// Test dimension operations
14321430
TEST_F(MinskySuite, dimensionOperations)
14331431
{
1434-
dimensions.emplace("testDim", Dimension("testDim", "test"));
1432+
// Create a dimension with proper Type enum (e.g., Dimension::value)
1433+
dimensions.emplace("testDim", Dimension(Dimension::value, "test"));
1434+
1435+
// Create a variable with this dimension in its hypercube
1436+
auto var1 = model->addItem(VariablePtr(VariableType::flow, "dimTestVar"));
1437+
auto hc = variableValues[":dimTestVar"]->tensorInit.hypercube();
1438+
hc.xvectors.emplace_back("testDim", Dimension(Dimension::value, "test"));
1439+
variableValues[":dimTestVar"]->tensorInit.hypercube(hc);
14351440

14361441
renameDimension("testDim", "newTestDim");
1442+
1443+
// Verify dimension was renamed in dimensions map
14371444
EXPECT_TRUE(dimensions.count("newTestDim") > 0);
14381445
EXPECT_TRUE(dimensions.count("testDim") == 0);
14391446

1447+
// Verify variableValue hypercube was also updated
1448+
auto updatedHc = variableValues[":dimTestVar"]->tensorInit.hypercube();
1449+
bool foundRenamed = false;
1450+
bool foundOld = false;
1451+
for (const auto& xv : updatedHc.xvectors) {
1452+
if (xv.name == "newTestDim") foundRenamed = true;
1453+
if (xv.name == "testDim") foundOld = true;
1454+
}
1455+
EXPECT_TRUE(foundRenamed);
1456+
EXPECT_FALSE(foundOld);
1457+
14401458
dimensions.clear();
14411459
}
14421460

0 commit comments

Comments
 (0)