Skip to content

Commit

Permalink
Nicer look
Browse files Browse the repository at this point in the history
  • Loading branch information
EuphoricThinking committed Sep 2, 2024
1 parent 0791fef commit e7a5858
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
24 changes: 11 additions & 13 deletions test/common/test_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,19 @@ static inline bool UT_LOG_ERR(const char *format, ...) {

// Assertions which does not impact the program execution
// Formatting is intended to resemble GTEST assertions outputs
#define GTEST_OUT_EQ(lhs, rhs) \
#define GTEST_OUT_EQ(lhs, rhs) \
((bool)(((lhs) == (rhs)) || \
UT_LOG_ERR("%s:%d %s - assertion failure\nExpected: %s == %s, actual: (0x%llx) vs (0x%llx)" \
, \
__FILE__, __LINE__, __func__, #lhs, \
#rhs, (unsigned long long)(lhs), \
(unsigned long long)(rhs))))

#define GTEST_OUT_NE(lhs, rhs) \
UT_LOG_ERR("%s:%d %s - assertion failure\nExpected: %s == %s, " \
"actual: (0x%llx) vs (0x%llx)", \
__FILE__, __LINE__, __func__, #lhs, #rhs, \
(unsigned long long)(lhs), (unsigned long long)(rhs))))

#define GTEST_OUT_NE(lhs, rhs) \
((bool)(((lhs) != (rhs)) || \
UT_LOG_ERR("%s:%d %s - assertion failure\nExpected: %s != %s, actual: (0x%llx) vs (0x%llx)" \
, \
__FILE__, __LINE__, __func__, #lhs, \
#rhs, (unsigned long long)(lhs), \
(unsigned long long)(rhs))))
UT_LOG_ERR("%s:%d %s - assertion failure\nExpected: %s != %s, " \
"actual: (0x%llx) vs (0x%llx)", \
__FILE__, __LINE__, __func__, #lhs, #rhs, \
(unsigned long long)(lhs), (unsigned long long)(rhs))))

// Assert a condition is true at runtime
#define UT_ASSERT(cnd) \
Expand Down
7 changes: 3 additions & 4 deletions test/memspaces/memspace_highest_bandwidth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static bool canQueryBandwidth(size_t nodeId) {
hwloc_topology_t topology = nullptr;
int ret = hwloc_topology_init(&topology);

if (!GTEST_OUT_EQ(ret, 0)){
if (!GTEST_OUT_EQ(ret, 0)) {
return false;
}

Expand All @@ -26,7 +26,7 @@ static bool canQueryBandwidth(size_t nodeId) {
hwloc_obj_t numaNode =
hwloc_get_obj_by_type(topology, HWLOC_OBJ_NUMANODE, nodeId);

if (!GTEST_OUT_NE(numaNode, nullptr)){
if (!GTEST_OUT_NE(numaNode, nullptr)) {
return false;
}

Expand All @@ -43,8 +43,7 @@ static bool canQueryBandwidth(size_t nodeId) {

if (!GTEST_OUT_EQ(ret, 0)) {
return false;
}
else {
} else {
return true;
}
}
Expand Down
3 changes: 1 addition & 2 deletions test/memspaces/memspace_lowest_latency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ static bool canQueryLatency(size_t nodeId) {

if (!GTEST_OUT_EQ(ret, 0)) {
return false;
}
else {
} else {
return true;
}
}
Expand Down

0 comments on commit e7a5858

Please sign in to comment.