Fibers allocation/deallocation benchmarks
[folly.git] / folly / test / LoggingTest.cpp
index 19d2341822668dbafcc8f23dd6c32258533e487a..ba778efbe5cc734d5af1bf530b315cae20caa808 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 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.
@@ -30,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)) {
@@ -40,6 +40,17 @@ TEST(LogEveryMs, basic) {
   EXPECT_TRUE(atLeastOneIsGood);
 }
 
+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);
+}
+
 BENCHMARK(skip_overhead, iter) {
   auto prev = FLAGS_minloglevel;
   FLAGS_minloglevel = 2;