(Wangle) Possibly undefined behavior in collect
[folly.git] / folly / test / ConcurrentSkipListTest.cpp
index f20fa8359c2f873d63985ccb4c6924d7a5b2d5be..2a26ae36b113864479f9fc29d727fed33772216e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013 Facebook, Inc.
+ * Copyright 2015 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 #include <glog/logging.h>
 #include <gflags/gflags.h>
-#include "folly/ConcurrentSkipList.h"
-#include "folly/Foreach.h"
-#include "folly/String.h"
-#include "gtest/gtest.h"
+#include <folly/ConcurrentSkipList.h>
+#include <folly/Foreach.h>
+#include <folly/String.h>
+#include <gtest/gtest.h>
 
 DEFINE_int32(num_threads, 12, "num concurrent threads to test");
 
@@ -104,8 +104,8 @@ TEST(ConcurrentSkipList, SequentialAccess) {
     LOG(INFO) << "nodetype size=" << sizeof(SkipListNodeType);
 
     auto skipList(SkipListType::create(kHeadHeight));
-    EXPECT_TRUE(skipList.first() == NULL);
-    EXPECT_TRUE(skipList.last() == NULL);
+    EXPECT_TRUE(skipList.first() == nullptr);
+    EXPECT_TRUE(skipList.last() == nullptr);
 
     skipList.add(3);
     EXPECT_TRUE(skipList.contains(3));
@@ -218,7 +218,7 @@ static std::string makeRandomeString(int len) {
 
 TEST(ConcurrentSkipList, TestStringType) {
   typedef folly::ConcurrentSkipList<std::string> SkipListT;
-  boost::shared_ptr<SkipListT> skip = SkipListT::createInstance();
+  std::shared_ptr<SkipListT> skip = SkipListT::createInstance();
   SkipListT::Accessor accessor(skip);
   {
     for (int i = 0; i < 100000; i++) {
@@ -273,7 +273,7 @@ void testConcurrentAdd(int numThreads) {
       << ": could only create " << threads.size() << " threads out of "
       << numThreads;
   }
-  for (int i = 0; i < threads.size(); ++i) {
+  for (size_t i = 0; i < threads.size(); ++i) {
     threads[i].join();
   }
 
@@ -389,7 +389,7 @@ TEST(ConcurrentSkipList, ConcurrentAccess) {
 int main(int argc, char* argv[]) {
   testing::InitGoogleTest(&argc, argv);
   google::InitGoogleLogging(argv[0]);
-  google::ParseCommandLineFlags(&argc, &argv, true);
+  gflags::ParseCommandLineFlags(&argc, &argv, true);
 
   return RUN_ALL_TESTS();
 }