51 lines
1.1 KiB
C++
51 lines
1.1 KiB
C++
#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;
|
|
}
|