X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Ftest%2FLoggingTest.cpp;h=f0640669f590d5803be7cd0dedfe0246bd4321e8;hb=eb7bc45f22e034751a76bf02445c669471e60780;hp=d84b641478880dc4b99c46c74273cf520ecbc280;hpb=6d89f3d33268eaa12d5eb03a4afa5caa856306c5;p=folly.git diff --git a/folly/test/LoggingTest.cpp b/folly/test/LoggingTest.cpp index d84b6414..f0640669 100644 --- a/folly/test/LoggingTest.cpp +++ b/folly/test/LoggingTest.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -15,8 +15,9 @@ */ #include -#include -#include + +#include + #include TEST(LogEveryMs, basic) { @@ -29,7 +30,7 @@ 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)) { @@ -39,8 +40,13 @@ TEST(LogEveryMs, basic) { 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); }