1 // Copyright 2023 gRPC authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // Auto generated by tools/codegen/core/gen_experiments.py
16
17 #include "test/core/experiments/fixtures/experiments.h"
18
19 #include <grpc/support/port_platform.h>
20
21 #include <memory>
22
23 #include "gtest/gtest.h"
24 #include "src/core/lib/experiments/config.h"
25
26 #ifndef GRPC_EXPERIMENTS_ARE_FINAL
27
28 #if defined(GRPC_CFSTREAM)
GetExperimentTestExperiment1ExpectedValue()29 bool GetExperimentTestExperiment1ExpectedValue() { return false; }
30
GetExperimentTestExperiment2ExpectedValue()31 bool GetExperimentTestExperiment2ExpectedValue() { return true; }
32
GetExperimentTestExperiment3ExpectedValue()33 bool GetExperimentTestExperiment3ExpectedValue() {
34 #ifdef NDEBUG
35 return false;
36 #else
37 return true;
38 #endif
39 }
40
GetExperimentTestExperiment4ExpectedValue()41 bool GetExperimentTestExperiment4ExpectedValue() { return true; }
42
43 #elif defined(GPR_WINDOWS)
GetExperimentTestExperiment1ExpectedValue()44 bool GetExperimentTestExperiment1ExpectedValue() { return false; }
45
GetExperimentTestExperiment2ExpectedValue()46 bool GetExperimentTestExperiment2ExpectedValue() { return false; }
47
GetExperimentTestExperiment3ExpectedValue()48 bool GetExperimentTestExperiment3ExpectedValue() {
49
50 #ifdef NDEBUG
51 return false;
52 #else
53 return true;
54 #endif
55 }
56
GetExperimentTestExperiment4ExpectedValue()57 bool GetExperimentTestExperiment4ExpectedValue() { return true; }
58
59 #else
GetExperimentTestExperiment1ExpectedValue()60 bool GetExperimentTestExperiment1ExpectedValue() {
61
62 #ifdef NDEBUG
63 return false;
64 #else
65 return true;
66 #endif
67 }
68
GetExperimentTestExperiment2ExpectedValue()69 bool GetExperimentTestExperiment2ExpectedValue() {
70
71 #ifdef NDEBUG
72 return false;
73 #else
74 return true;
75 #endif
76 }
77
GetExperimentTestExperiment3ExpectedValue()78 bool GetExperimentTestExperiment3ExpectedValue() {
79
80 #ifdef NDEBUG
81 return false;
82 #else
83 return true;
84 #endif
85 }
86
GetExperimentTestExperiment4ExpectedValue()87 bool GetExperimentTestExperiment4ExpectedValue() { return false; }
88 #endif
89
TEST(ExperimentsTest,CheckExperimentValuesTest)90 TEST(ExperimentsTest, CheckExperimentValuesTest) {
91 ASSERT_EQ(grpc_core::IsTestExperiment1Enabled(),
92 GetExperimentTestExperiment1ExpectedValue());
93
94 ASSERT_EQ(grpc_core::IsTestExperiment2Enabled(),
95 GetExperimentTestExperiment2ExpectedValue());
96
97 ASSERT_EQ(grpc_core::IsTestExperiment3Enabled(),
98 GetExperimentTestExperiment3ExpectedValue());
99
100 ASSERT_EQ(grpc_core::IsTestExperiment4Enabled(),
101 GetExperimentTestExperiment4ExpectedValue());
102 }
103
104 #endif // GRPC_EXPERIMENTS_ARE_FINAL
105
main(int argc,char ** argv)106 int main(int argc, char** argv) {
107 testing::InitGoogleTest(&argc, argv);
108 grpc_core::LoadTestOnlyExperimentsFromMetadata(
109 grpc_core::g_test_experiment_metadata, grpc_core::kNumTestExperiments);
110 return RUN_ALL_TESTS();
111 }
112