mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 21:49:24 +08:00
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159604 Approved by: https://github.com/albanD, https://github.com/desertfire
26 lines
746 B
C++
26 lines
746 B
C++
#include <gtest/gtest.h>
|
|
|
|
#include <torch/headeronly/util/Exception.h>
|
|
#include <torch/headeronly/util/shim_utils.h>
|
|
|
|
namespace torch {
|
|
namespace aot_inductor {
|
|
|
|
TEST(TestExceptions, TestStdTorchCheck) {
|
|
EXPECT_NO_THROW(STD_TORCH_CHECK(true, "dummy true message"));
|
|
EXPECT_NO_THROW(STD_TORCH_CHECK(true, "dummy ", "true ", "message"));
|
|
EXPECT_THROW(
|
|
STD_TORCH_CHECK(false, "dummy false message"), std::runtime_error);
|
|
EXPECT_THROW(
|
|
STD_TORCH_CHECK(false, "dummy ", "false ", "message"),
|
|
std::runtime_error);
|
|
}
|
|
|
|
TEST(TestExceptions, TestTorchErrorCodeCheck) {
|
|
EXPECT_NO_THROW(TORCH_ERROR_CODE_CHECK(0));
|
|
EXPECT_THROW(TORCH_ERROR_CODE_CHECK(1), std::runtime_error);
|
|
}
|
|
|
|
} // namespace aot_inductor
|
|
} // namespace torch
|