Files
FESADev/tests/unit/core/source_identity_test.cpp
T

29 lines
1.0 KiB
C++

#include "fesa/core/source_identity.h"
#include <gtest/gtest.h>
#include <cstdint>
#include <filesystem>
#include <string>
TEST(CoreDiagnostics, SourceIdentityPreservesRawIdentity) {
const fesa::SourceLocation location{
std::filesystem::path{"models/My Beam.inp"}, 27U};
const fesa::SourceEntityId identity{"Beam-Instance_A", std::int64_t{42},
"00042"};
EXPECT_EQ(location.file, std::filesystem::path{"models/My Beam.inp"});
EXPECT_EQ(location.line, 27U);
EXPECT_EQ(identity.instance_name, "Beam-Instance_A");
EXPECT_EQ(identity.source_label, 42);
EXPECT_EQ(identity.source_label_text, "00042");
EXPECT_TRUE(fesa::SourceIdentityEquals(identity, identity));
EXPECT_FALSE(fesa::SourceIdentityEquals(
identity, {"beam-instance_a", std::int64_t{42}, "00042"}));
EXPECT_FALSE(fesa::SourceIdentityEquals(
identity, {"Beam-Instance_A", std::int64_t{43}, "00042"}));
EXPECT_FALSE(fesa::SourceIdentityEquals(
identity, {"Beam-Instance_A", std::int64_t{42}, "42"}));
}