summaryrefslogtreecommitdiff
path: root/absl/container/flat_hash_set_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/container/flat_hash_set_test.cc')
-rw-r--r--absl/container/flat_hash_set_test.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/absl/container/flat_hash_set_test.cc b/absl/container/flat_hash_set_test.cc
index 40d7f85c..8f6f9944 100644
--- a/absl/container/flat_hash_set_test.cc
+++ b/absl/container/flat_hash_set_test.cc
@@ -16,6 +16,7 @@
#include <vector>
+#include "absl/base/internal/raw_logging.h"
#include "absl/container/internal/hash_generator_testing.h"
#include "absl/container/internal/unordered_set_constructor_test.h"
#include "absl/container/internal/unordered_set_lookup_test.h"
@@ -36,6 +37,17 @@ using ::testing::Pointee;
using ::testing::UnorderedElementsAre;
using ::testing::UnorderedElementsAreArray;
+// Check that absl::flat_hash_set works in a global constructor.
+struct BeforeMain {
+ BeforeMain() {
+ absl::flat_hash_set<int> x;
+ x.insert(1);
+ ABSL_RAW_CHECK(!x.contains(0), "x should not contain 0");
+ ABSL_RAW_CHECK(x.contains(1), "x should contain 1");
+ }
+};
+const BeforeMain before_main;
+
template <class T>
using Set =
absl::flat_hash_set<T, StatefulTestingHash, StatefulTestingEqual, Alloc<T>>;