Skip to content

Commit d1ca753

Browse files
committed
Fix unit-test
1 parent b6b6a15 commit d1ca753

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/unit-tests/Source/core/base/VectorTests.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ TEST_SUITE("base/Vector") {
258258

259259
// get random object
260260
// Set the seed by time
261-
std::srand((unsigned)time(nullptr));
261+
auto seed = (unsigned)time(nullptr);
262+
std::srand(seed);
262263
Vector<Node*> vecForRandom = createVector();
263264
auto different = 0;
264265
for (int i = 0; i < vecForRandom.size(); ++i) {
@@ -268,7 +269,9 @@ TEST_SUITE("base/Vector") {
268269
different++;
269270
}
270271
CHECK(different > 0);
271-
CHECK(different > vecForRandom.size() * 3 / 4); // At least 75% different
272+
auto count75 = vecForRandom.size() * 3 / 4;
273+
CHECK(different >= count75); // At least 75% different
274+
AXLOGI("## seed={}, different={}, count75={}", seed, different, count75);
272275

273276
// Self assignment
274277
Vector<Node*> vecSelfAssign = createVector();

0 commit comments

Comments
 (0)