Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit testing for Slic ranks and rank counts #1431

Merged
merged 14 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/axom/core/utilities/FileUtilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ void getDirName(std::string& dir, const std::string& path);
* \param filename The name of the file.
* \return 0 on success, -1 on failure. errno can obtain more information
* about the failure.
*
* \note On Windows, this function calls _unlink() and will fail if there are
* any open file handles to the specified file.
* On Linux, this function calls unlink() and will succeed even if
* there are open file handles to the specified file.
*/
int removeFile(const std::string& filename);

Expand Down
78 changes: 39 additions & 39 deletions src/axom/slic/interface/slic_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@
if(!(EXP)) \
{ \
std::ostringstream __oss; \
__oss << "Failed Assert: " << #EXP << std::ends; \
__oss << "Failed Assert: " << #EXP; \
axom::slic::logErrorMessage(__oss.str(), __FILE__, __LINE__); \
if(axom::slic::isAbortOnErrorsEnabled()) \
{ \
Expand All @@ -365,19 +365,19 @@
* \endcode
*
*/
#define SLIC_ASSERT_MSG(EXP, msg) \
do \
{ \
if(!(EXP)) \
{ \
std::ostringstream __oss; \
__oss << "Failed Assert: " << #EXP << std::endl << msg << std::ends; \
axom::slic::logErrorMessage(__oss.str(), __FILE__, __LINE__); \
if(axom::slic::isAbortOnErrorsEnabled()) \
{ \
axom::slic::abort(); \
} \
} \
#define SLIC_ASSERT_MSG(EXP, msg) \
do \
{ \
if(!(EXP)) \
{ \
std::ostringstream __oss; \
__oss << "Failed Assert: " << #EXP << std::endl << msg; \
axom::slic::logErrorMessage(__oss.str(), __FILE__, __LINE__); \
if(axom::slic::isAbortOnErrorsEnabled()) \
{ \
axom::slic::abort(); \
} \
} \
} while(axom::slic::detail::false_value)

///@}
Expand Down Expand Up @@ -427,7 +427,7 @@
if(!(EXP)) \
{ \
std::ostringstream __oss; \
__oss << "Failed Check: " << #EXP << std::ends; \
__oss << "Failed Check: " << #EXP; \
if(axom::slic::debug::checksAreErrors) \
{ \
axom::slic::logErrorMessage(__oss.str(), __FILE__, __LINE__); \
Expand Down Expand Up @@ -463,30 +463,30 @@
* \endcode
*
*/
#define SLIC_CHECK_MSG(EXP, msg) \
do \
{ \
if(!(EXP)) \
{ \
std::ostringstream __oss; \
__oss << "Failed Check: " << #EXP << std::endl << msg << std::ends; \
if(axom::slic::debug::checksAreErrors) \
{ \
axom::slic::logErrorMessage(__oss.str(), __FILE__, __LINE__); \
if(axom::slic::isAbortOnErrorsEnabled()) \
{ \
axom::slic::abort(); \
} \
} \
else \
{ \
axom::slic::logWarningMessage(__oss.str(), __FILE__, __LINE__); \
if(axom::slic::isAbortOnWarningsEnabled()) \
{ \
axom::slic::abort(); \
} \
} \
} \
#define SLIC_CHECK_MSG(EXP, msg) \
do \
{ \
if(!(EXP)) \
{ \
std::ostringstream __oss; \
__oss << "Failed Check: " << #EXP << std::endl << msg; \
if(axom::slic::debug::checksAreErrors) \
{ \
axom::slic::logErrorMessage(__oss.str(), __FILE__, __LINE__); \
if(axom::slic::isAbortOnErrorsEnabled()) \
{ \
axom::slic::abort(); \
} \
} \
else \
{ \
axom::slic::logWarningMessage(__oss.str(), __FILE__, __LINE__); \
if(axom::slic::isAbortOnWarningsEnabled()) \
{ \
axom::slic::abort(); \
} \
} \
} \
} while(axom::slic::detail::false_value)

/// @}
Expand Down
2 changes: 1 addition & 1 deletion src/axom/slic/tests/slic_macros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ TEST(slic_macros, test_macros_file_output)
std::string no_fmt_expected;
no_fmt_expected += "*****\n[INFO]\n\n Test \n\n ";
no_fmt_expected += __FILE__;
no_fmt_expected += "\n440\n****\n";
no_fmt_expected += "\n" + std::to_string(__LINE__ - 19) + "\n****\n";

EXPECT_EQ(no_fmt_buffer.str(), no_fmt_expected);

Expand Down
Loading