mirror of
https://github.com/microsoft/mscclpp.git
synced 2026-05-12 09:17:06 +00:00
- Modified test/mp_unit/mp_unit_tests.hpp to use ../framework.hpp instead of gtest/gtest.h - Enhanced test/framework.hpp with GTest-compatible APIs: - Added Environment base class for global test setup/teardown - Added TestInfo and UnitTest classes for test metadata access - Added GTEST_SKIP macro support via SkipHelper class - Added namespace alias 'testing' for compatibility - Added InitGoogleTest and AddGlobalTestEnvironment helper functions - Updated test/framework.cc with implementations for new classes - All mp_unit test files now use framework.hpp through mp_unit_tests.hpp - Formatting applied via lint.sh Co-authored-by: chhwang <8018170+chhwang@users.noreply.github.com>
31 lines
1.1 KiB
C++
31 lines
1.1 KiB
C++
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT license.
|
|
|
|
#include <mscclpp/errors.hpp>
|
|
|
|
#include "../framework.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)"));
|
|
}
|