diff options
author | Daniel <daniel.cohen599@gmail.com> | 2020-06-19 20:40:03 +0100 |
---|---|---|
committer | Nathan James <n.james93@hotmail.co.uk> | 2020-06-19 20:40:59 +0100 |
commit | af4f2eb476361e6da42d6f66a68cada763625c32 (patch) | |
tree | 2fa7ff0fb1683dcb4a09d936abb7612907d94568 /llvm/unittests/ADT/StringMapTest.cpp | |
parent | 216a37bb4643279b548e85d98618a69475f1328c (diff) | |
download | llvm-af4f2eb476361e6da42d6f66a68cada763625c32.zip llvm-af4f2eb476361e6da42d6f66a68cada763625c32.tar.gz llvm-af4f2eb476361e6da42d6f66a68cada763625c32.tar.bz2 |
[clang-tidy] remove duplicate fixes of alias checkers
when both a check and its alias are enabled, we should only take the fixes of one of them and not both.
This patch fixes bug 45577
https://bugs.llvm.org/show_bug.cgi?id=45577
Reviewed By: aaron.ballman, njames93
Differential Revision: https://reviews.llvm.org/D80753
Diffstat (limited to 'llvm/unittests/ADT/StringMapTest.cpp')
-rw-r--r-- | llvm/unittests/ADT/StringMapTest.cpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/StringMapTest.cpp b/llvm/unittests/ADT/StringMapTest.cpp index 73c91f5..98fbd6e 100644 --- a/llvm/unittests/ADT/StringMapTest.cpp +++ b/llvm/unittests/ADT/StringMapTest.cpp @@ -387,6 +387,70 @@ TEST_F(StringMapTest, MoveAssignment) { ASSERT_EQ(B.count("x"), 0u); } +TEST_F(StringMapTest, EqualEmpty) { + StringMap<int> A; + StringMap<int> B; + ASSERT_TRUE(A == B); + ASSERT_FALSE(A != B); + ASSERT_TRUE(A == A); // self check +} + +TEST_F(StringMapTest, EqualWithValues) { + StringMap<int> A; + A["A"] = 1; + A["B"] = 2; + A["C"] = 3; + A["D"] = 3; + + StringMap<int> B; + B["A"] = 1; + B["B"] = 2; + B["C"] = 3; + B["D"] = 3; + + ASSERT_TRUE(A == B); + ASSERT_TRUE(B == A); + ASSERT_FALSE(A != B); + ASSERT_FALSE(B != A); + ASSERT_TRUE(A == A); // self check +} + +TEST_F(StringMapTest, NotEqualMissingKeys) { + StringMap<int> A; + A["A"] = 1; + A["B"] = 2; + + StringMap<int> B; + B["A"] = 1; + B["B"] = 2; + B["C"] = 3; + B["D"] = 3; + + ASSERT_FALSE(A == B); + ASSERT_FALSE(B == A); + ASSERT_TRUE(A != B); + ASSERT_TRUE(B != A); +} + +TEST_F(StringMapTest, NotEqualWithDifferentValues) { + StringMap<int> A; + A["A"] = 1; + A["B"] = 2; + A["C"] = 100; + A["D"] = 3; + + StringMap<int> B; + B["A"] = 1; + B["B"] = 2; + B["C"] = 3; + B["D"] = 3; + + ASSERT_FALSE(A == B); + ASSERT_FALSE(B == A); + ASSERT_TRUE(A != B); + ASSERT_TRUE(B != A); +} + struct Countable { int &InstanceCount; int Number; |