Rename //explorer/common to base (#3103)

Renaming per #3100
This commit is contained in:
Jon Ross-Perkins
2023-08-15 19:23:23 +00:00
committed by GitHub
parent a6ba7827cd
commit 357baaeef8
80 changed files with 194 additions and 194 deletions
+39
View File
@@ -0,0 +1,39 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include "explorer/base/decompose.h"
#include <gtest/gtest.h>
namespace Carbon {
namespace {
struct Decomposeable : public HashFromDecompose<Decomposeable> {
template <typename F>
auto Decompose(F f) const {
return f(i, s);
}
int i = 0;
std::string s;
};
TEST(HashFromDecomposeTest, EqualValues) {
Decomposeable d1 = {.i = 42, .s = "foo"};
Decomposeable d2 = {.i = 42, .s = "foo"};
EXPECT_TRUE(d1 == d2);
EXPECT_TRUE(hash_value(d1) == hash_value(d2));
}
TEST(HashFromDecomposeTest, NonEqualValues) {
Decomposeable d1 = {.i = 42, .s = "foo"};
Decomposeable d2 = {.i = 42, .s = "bar"};
EXPECT_FALSE(d1 == d2);
EXPECT_FALSE(hash_value(d1) == hash_value(d2));
}
} // namespace
} // namespace Carbon