================ @@ -0,0 +1,65 @@ +//===- unittests/Analysis/Scalable/EntityIdTest.cpp ----------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "clang/Analysis/Scalable/Model/EntityId.h" +#include "clang/Analysis/Scalable/Model/EntityIdTable.h" +#include "clang/Analysis/Scalable/Model/EntityName.h" +#include "gtest/gtest.h" + +namespace clang { +namespace ssaf { +namespace { + +TEST(EntityIdTest, Equality) { + EntityIdTable Table; + + EntityName Entity1("c:@F@foo", "", {}); + EntityName Entity2("c:@F@bar", "", {}); + + EntityId Id1 = Table.getId(Entity1); + EntityId Id2 = Table.getId(Entity2); + EntityId Id1Copy = Table.getId(Entity1); + + EXPECT_EQ(Id1, Id1Copy); + EXPECT_FALSE(Id1 != Id1Copy); + + EXPECT_NE(Id1, Id2); + EXPECT_FALSE(Id1 == Id2); ---------------- steakhal wrote:
Should we also check that equality and inequality implies that neither are "smaller"? https://github.com/llvm/llvm-project/pull/171660 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
