Fix copyright lines
[folly.git] / folly / io / test / RecordIOTest.cpp
index f4d20bad758d3e40985e571e19e41967436c81e0..86d3d5aa0a1e3ec4a7ecc5408a5d4395ec11060d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2013-present 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 <folly/io/RecordIO.h>
 
 #include <sys/types.h>
-#include <unistd.h>
 
 #include <random>
 
-#include <gflags/gflags.h>
 #include <glog/logging.h>
-#include <gtest/gtest.h>
 
 #include <folly/Conv.h>
 #include <folly/FBString.h>
 #include <folly/Random.h>
 #include <folly/experimental/TestUtil.h>
 #include <folly/io/IOBufQueue.h>
+#include <folly/portability/GFlags.h>
+#include <folly/portability/GTest.h>
+#include <folly/portability/Unistd.h>
 
 DEFINE_int32(random_seed, folly::randomNumberSeed(), "random seed");
 
-namespace folly { namespace test {
+namespace folly {
+namespace test {
 
 namespace {
 // shortcut
@@ -49,7 +50,7 @@ std::unique_ptr<IOBuf> iobufs(std::initializer_list<T> ranges) {
   return queue.move();
 }
 
-}  // namespace
+} // namespace
 
 TEST(RecordIOTest, Simple) {
   TemporaryFile file;
@@ -94,14 +95,14 @@ TEST(RecordIOTest, SmallRecords) {
   TemporaryFile file;
   {
     RecordIOWriter writer(File(file.fd()));
-    for (int i = 0; i < kSize; ++i) {  // record of size 0 should be ignored
+    for (size_t i = 0; i < kSize; ++i) {  // record of size 0 should be ignored
       writer.write(IOBuf::wrapBuffer(tmp, i));
     }
   }
   {
     RecordIOReader reader(File(file.fd()));
     auto it = reader.begin();
-    for (int i = 1; i < kSize; ++i) {
+    for (size_t i = 1; i < kSize; ++i) {
       ASSERT_FALSE(it == reader.end());
       EXPECT_EQ(StringPiece(tmp, i), sp((it++)->first));
     }
@@ -189,7 +190,7 @@ void corrupt(int fd, off_t pos) {
   ++val;
   EXPECT_EQ(1, pwrite(fd, &val, 1, pos));
 }
-}  // namespace
+} // namespace
 
 TEST(RecordIOTest, Randomized) {
   SCOPED_TRACE(to<std::string>("Random seed is ", FLAGS_random_seed));
@@ -262,11 +263,12 @@ TEST(RecordIOTest, Randomized) {
     EXPECT_EQ(records.size(), i);
   }
 }
+} // namespace test
+} // namespace folly
 
-}}  // namespaces
 
 int main(int argc, char *argv[]) {
   testing::InitGoogleTest(&argc, argv);
-  google::ParseCommandLineFlags(&argc, &argv, true);
+  gflags::ParseCommandLineFlags(&argc, &argv, true);
   return RUN_ALL_TESTS();
 }