2 * Copyright 2014 Facebook, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "folly/AtomicBitSet.h"
19 #include <glog/logging.h>
20 #include <gtest/gtest.h>
22 namespace folly { namespace test {
24 TEST(AtomicBitSet, Simple) {
25 constexpr size_t kSize = 1000;
26 AtomicBitSet<kSize> bs;
28 EXPECT_EQ(kSize, bs.size());
30 for (size_t i = 0; i < kSize; ++i) {
35 for (size_t i = 0; i < kSize; ++i) {
36 EXPECT_EQ(i == 42, bs[i]);
40 for (size_t i = 0; i < kSize; ++i) {
41 EXPECT_EQ((i == 42 || i == 43), bs[i]);
45 for (size_t i = 0; i < kSize; ++i) {
46 EXPECT_EQ((i == 43), bs[i]);
50 for (size_t i = 0; i < kSize; ++i) {
57 int main(int argc, char *argv[]) {
58 testing::InitGoogleTest(&argc, argv);
59 google::ParseCommandLineFlags(&argc, &argv, true);
60 return RUN_ALL_TESTS();