feat(solver-bootstrap): step 3 — core-ids-and-diagnostics
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#include <filesystem>
|
||||
#include <vector>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <fesa/core/status.hpp>
|
||||
|
||||
namespace {
|
||||
|
||||
TEST(CoreStatus, PreservesFailureDiagnostics) {
|
||||
const fesa::Status status{
|
||||
false,
|
||||
{fesa::Diagnostic{
|
||||
fesa::DiagnosticStage::model,
|
||||
fesa::Severity::error,
|
||||
"MODEL_NONFINITE_VECTOR",
|
||||
"A vector component is not finite.",
|
||||
fesa::SourceLocation{
|
||||
std::filesystem::path{"models/invalid.inp"}, 8, 3}}}};
|
||||
|
||||
EXPECT_FALSE(status.succeeded);
|
||||
ASSERT_EQ(status.diagnostics.size(), 1U);
|
||||
EXPECT_EQ(status.diagnostics.front().code, "MODEL_NONFINITE_VECTOR");
|
||||
ASSERT_TRUE(status.diagnostics.front().source.has_value());
|
||||
EXPECT_EQ(status.diagnostics.front().source->line, 8U);
|
||||
}
|
||||
|
||||
TEST(CoreStatus, RepresentsSuccessWithoutDiagnostics) {
|
||||
const fesa::Status status{true, {}};
|
||||
|
||||
EXPECT_TRUE(status.succeeded);
|
||||
EXPECT_TRUE(status.diagnostics.empty());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
Reference in New Issue
Block a user