feat: add solver core skeleton
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
#include <fesa/core/diagnostic.hpp>
|
||||
#include <fesa/core/ids.hpp>
|
||||
#include <fesa/core/status.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
namespace {
|
||||
|
||||
int fail()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!std::is_same_v<fesa::core::NodeId, fesa::core::ElementId>);
|
||||
|
||||
const auto ok = fesa::core::Status::ok();
|
||||
if (!ok.is_ok() || !ok.diagnostics().empty()) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
fesa::core::Diagnostic error{
|
||||
fesa::core::Severity::error,
|
||||
"core.error",
|
||||
"core failure"
|
||||
};
|
||||
auto failed = fesa::core::Status::failure(error);
|
||||
if (failed.is_ok() || failed.diagnostics().size() != 1) {
|
||||
return fail();
|
||||
}
|
||||
if (failed.diagnostics()[0].code != "core.error" ||
|
||||
failed.diagnostics()[0].message != "core failure") {
|
||||
return fail();
|
||||
}
|
||||
|
||||
failed.add({fesa::core::Severity::warning, "core.warning", "check warning"});
|
||||
if (failed.diagnostics().size() != 2) {
|
||||
return fail();
|
||||
}
|
||||
if (failed.diagnostics()[0].code != "core.error" ||
|
||||
failed.diagnostics()[1].code != "core.warning") {
|
||||
return fail();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user