[llvm] [ADT] Add a unittest for the ScopedHashTable class (PR #120183)
Jakub Kuderski via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 17 06:53:54 PST 2024
================
@@ -0,0 +1,144 @@
+//===- ScopedHashTableTest.cpp - ScopedHashTable unit tests ---------------===//
+//
+// 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 "llvm/ADT/ScopedHashTable.h"
+#include "llvm/ADT/StringRef.h"
+#include "gtest/gtest.h"
+#include <memory>
+#include <stack>
+
+using ::llvm::ScopedHashTable;
+using ::llvm::ScopedHashTableScope;
+using ::llvm::StringRef;
+
+using ::testing::Test;
+
+class ScopedHashTableTest : public Test {
+protected:
+ ScopedHashTableTest() { symbolTable.insert(kGlobalName, kGlobalValue); }
+
+ ScopedHashTable<StringRef, StringRef> symbolTable{};
+ ScopedHashTableScope<StringRef, StringRef> globalScope{symbolTable};
+
+ static constexpr StringRef kGlobalName = "global";
----------------
kuhar wrote:
Use StringLiteral?
https://github.com/llvm/llvm-project/pull/120183
More information about the llvm-commits
mailing list