Files
mscclpp/test/unit/errors_tests.cc
Changho Hwang c4a5958dfc Fix hanging bootstrap issues (#100)
* Renew socket interfaces and error handling into C++ style
* Fix bootstrap hanging bugs
* Misc code cleanup

---------

Co-authored-by: Binyang Li <binyli@microsoft.com>
Co-authored-by: Saeed Maleki <saemal@microsoft.com>
2023-06-15 11:29:49 +08:00

28 lines
1.0 KiB
C++

#include <gtest/gtest.h>
#include <mscclpp/errors.hpp>
TEST(ErrorsTest, SystemError) {
mscclpp::Error error("test", mscclpp::ErrorCode::SystemError);
EXPECT_EQ(error.getErrorCode(), mscclpp::ErrorCode::SystemError);
EXPECT_EQ(error.what(), std::string("test (Mscclpp failure: SystemError)"));
}
TEST(ErrorsTest, InternalError) {
mscclpp::Error error("test", mscclpp::ErrorCode::InternalError);
EXPECT_EQ(error.getErrorCode(), mscclpp::ErrorCode::InternalError);
EXPECT_EQ(error.what(), std::string("test (Mscclpp failure: InternalError)"));
}
TEST(ErrorsTest, InvalidUsage) {
mscclpp::Error error("test", mscclpp::ErrorCode::InvalidUsage);
EXPECT_EQ(error.getErrorCode(), mscclpp::ErrorCode::InvalidUsage);
EXPECT_EQ(error.what(), std::string("test (Mscclpp failure: InvalidUsage)"));
}
TEST(ErrorsTest, Timeout) {
mscclpp::Error error("test", mscclpp::ErrorCode::Timeout);
EXPECT_EQ(error.getErrorCode(), mscclpp::ErrorCode::Timeout);
EXPECT_EQ(error.what(), std::string("test (Mscclpp failure: Timeout)"));
}