feat(solver-bootstrap): step 3 — core-ids-and-diagnostics

This commit is contained in:
KOKO\Mimi
2026-07-30 13:01:15 +09:00
parent 3e44deed72
commit 34d21f43fe
10 changed files with 255 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
#include <filesystem>
#include <optional>
#include <string>
#include <gtest/gtest.h>
#include <fesa/core/diagnostic.hpp>
namespace {
TEST(Diagnostic, PreservesSourceLocation) {
const fesa::Diagnostic diagnostic{
fesa::DiagnosticStage::syntax,
fesa::Severity::error,
"ABAQUS_INVALID_NODE",
"Node data is incomplete.",
fesa::SourceLocation{
std::filesystem::path{"models/beam.inp"}, 42, 9}};
ASSERT_TRUE(diagnostic.source.has_value());
EXPECT_EQ(
diagnostic.source->file, std::filesystem::path{"models/beam.inp"});
EXPECT_EQ(diagnostic.source->line, 42U);
EXPECT_EQ(diagnostic.source->column, 9U);
}
TEST(Diagnostic, AllowsDiagnosticsWithoutSourceLocation) {
const fesa::Diagnostic diagnostic{
fesa::DiagnosticStage::solver,
fesa::Severity::warning,
"SOLVER_RESIDUAL",
"Residual is above the reporting threshold.",
std::nullopt};
EXPECT_FALSE(diagnostic.source.has_value());
}
} // namespace