Skip to content

Commit

Permalink
Improve test assertion messages
Browse files Browse the repository at this point in the history
  • Loading branch information
FooBarWidget committed Oct 4, 2024
1 parent 55015c9 commit bca979a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/cxx/SystemTools/ProcessMetricsCollectorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,22 @@ namespace tut {
collector.measureRealMemory(child, pss, privateDirty, swap);
#ifdef __APPLE__
if (geteuid() == 0) {
ensure(pss > 50000 && pss < 60000);
ensure(privateDirty > 50000 && privateDirty < 60000);
ensure_equals(swap, (ssize_t) -1);
ensure("PSS is correct", pss > 50000 && pss < 60000);
ensure("Private dirty is correct", privateDirty > 50000 && privateDirty < 60000);
ensure_equals("Swap is correct", swap, (ssize_t) -1);
} else {
ensure_equals(pss, (ssize_t) -1);
ensure_equals(privateDirty, (ssize_t) -1);
ensure_equals(swap, (ssize_t) -1);
ensure_equals("PSS is correct", pss, (ssize_t) -1);
ensure_equals("Private dirty is correct", privateDirty, (ssize_t) -1);
ensure_equals("Swap is correct", swap, (ssize_t) -1);
}
#elif defined(__linux__)
ensure("PSS is correct", (pss > 50000 && pss < 60000) || pss == -1);
ensure("Private dirty is correct", privateDirty > 50000 && privateDirty < 60000);
ensure("Swap is correct", swap < 10000);
#else
ensure((pss > 50000 && pss < 60000) || pss == -1);
ensure((privateDirty > 50000 && privateDirty < 60000) || privateDirty == -1);
ensure(swap < 10000 || swap == -1);
ensure("PSS is correct", (pss > 50000 && pss < 60000) || pss == -1);
ensure("Private dirty is correct", (privateDirty > 50000 && privateDirty < 60000) || privateDirty == -1);
ensure("Swap is correct", (swap < 10000 || swap == -1));
#endif
}
}

0 comments on commit bca979a

Please sign in to comment.