2 * Copyright 2017 Facebook, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <folly/experimental/flat_combining/test/FlatCombiningTestHelpers.h>
19 #include <folly/portability/GTest.h>
20 #include <glog/logging.h>
22 using namespace folly::test;
24 constexpr int LINES = 5;
25 constexpr int NUM_RECS = 20;
26 constexpr int WORK = 0;
27 constexpr int ITERS = 100;
29 static std::vector<int> nthr = {1, 10, 20};
32 bool combining, simple, dedicated, tc, syncop;
35 class FlatCombiningTest : public ::testing::TestWithParam<Params> {};
37 TEST_P(FlatCombiningTest, combining) {
38 Params p = GetParam();
56 TEST_P(FlatCombiningTest, more_threads_than_records) {
60 Params p = GetParam();
76 constexpr Params params[] = {
77 {false, false, false, false, false}, // no combining
80 {true, true, true, false, true}, // no-tc sync
81 {true, true, true, false, false}, // no-tc async
82 {true, true, true, true, true}, // tc sync
83 {true, true, true, true, false}, // tc async
85 {true, true, false, false, true}, // no-tc sync
86 {true, true, false, false, false}, // no-tc async
87 {true, true, false, true, true}, // tc sync
88 {true, true, false, true, false}, // tc async
91 {true, false, true, false, true}, // no-tc sync
92 {true, false, true, false, false}, // no-tc async
93 {true, false, true, true, true}, // tc sync
94 {true, false, true, true, false}, // tc async
96 {true, false, false, false, true}, // no-tc sync
97 {true, false, false, false, false}, // no-tc async
98 {true, false, false, true, true}, // tc sync
99 {true, false, false, true, false}, // tc async
102 INSTANTIATE_TEST_CASE_P(Foo, FlatCombiningTest, ::testing::ValuesIn(params));