/*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2017 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/Logging.h>
-#include <gflags/gflags.h>
-#include <gtest/gtest.h>
+
+#include <folly/portability/GTest.h>
+
#include <vector>
TEST(LogEveryMs, basic) {
}
bool atLeastOneIsGood = false;
- for (int i = 0; i < hist.size() - 1; ++i) {
+ for (size_t i = 0; i < hist.size() - 1; ++i) {
auto delta = hist[i + 1] - hist[i];
if (delta > std::chrono::milliseconds(5) &&
delta < std::chrono::milliseconds(15)) {
EXPECT_TRUE(atLeastOneIsGood);
}
-int main(int argc, char** argv) {
- testing::InitGoogleTest(&argc, argv);
- google::ParseCommandLineFlags(&argc, &argv, true);
- return RUN_ALL_TESTS();
+TEST(LogEveryMs, zero) {
+ int count = 0;
+
+ for (int i = 0; i < 10; ++i) {
+ FB_LOG_EVERY_MS(INFO, 0)
+ << "test msg " << ++count;
+ }
+
+ EXPECT_EQ(10, count);
}