Skip to content

Commit a3728b0

Browse files
Address review comments: use unique temp file and improve assertions
- Replace hardcoded /tmp/test_log.dat with unique temporary file using boost::filesystem - Change EXPECT_TRUE comparisons to EXPECT_GT and EXPECT_EQ for better test clarity - Add boost::filesystem include and using directive Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
1 parent af53538 commit a3728b0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/testMinsky.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
#include <fstream>
2727
#include <cstdio>
2828
#include <algorithm>
29+
#include <boost/filesystem.hpp>
2930
using namespace minsky;
31+
using namespace boost::filesystem;
3032

3133
namespace
3234
{
@@ -1291,7 +1293,7 @@ TEST(TensorOps, evalOpEvaluate)
12911293
logVarList.insert(":testVar1");
12921294
logVarList.insert(":testVar2");
12931295

1294-
string logFile = "/tmp/test_log.dat";
1296+
string logFile = (temp_directory_path() / unique_path("test_log_%%%%-%%%%.dat")).string();
12951297
openLogFile(logFile);
12961298
EXPECT_TRUE(loggingEnabled());
12971299

@@ -1443,8 +1445,8 @@ TEST(TensorOps, evalOpEvaluate)
14431445
renameDimension("testDim", "newTestDim");
14441446

14451447
// Verify dimension was renamed in dimensions map
1446-
EXPECT_TRUE(dimensions.count("newTestDim") > 0);
1447-
EXPECT_TRUE(dimensions.count("testDim") == 0);
1448+
EXPECT_GT(dimensions.count("newTestDim"), 0);
1449+
EXPECT_EQ(dimensions.count("testDim"), 0);
14481450

14491451
// Verify variableValue hypercube was also updated
14501452
auto updatedHc = variableValues[":dimTestVar"]->tensorInit.hypercube();

0 commit comments

Comments
 (0)