Refactor stats to use the same type for indexes
[folly.git] / folly / test / ForeachTest.cpp
index 9904084d631ce816280e265559c0903a85179789..d7de3117296b4a004cc72adebd0e93ff004fd10f 100644 (file)
@@ -40,6 +40,18 @@ TEST(Foreach, ForEachRvalue) {
   EXPECT_EQ(0, n);
 }
 
+TEST(Foreach, ForEachNested) {
+  const std::string hello = "hello";
+  size_t n = 0;
+  FOR_EACH(i, hello) {
+    FOR_EACH(j, hello) {
+      ++n;
+    }
+  }
+  auto len = hello.size();
+  EXPECT_EQ(len * len, n);
+}
+
 TEST(Foreach, ForEachKV) {
   std::map<std::string, int> testMap;
   testMap["abc"] = 1;