diff options
author | David Garcia Quintas <dgq@google.com> | 2017-11-29 13:33:39 -0800 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2017-11-29 13:33:39 -0800 |
commit | 2258cd7ddc50b84d1c5589be99fad2c4278707b9 (patch) | |
tree | 26363a7f61e7f99544aa3fac49f0df9f2fdd42dc /test/core | |
parent | d3f6eae6694189bc9547acc6a95f9c94add4508b (diff) |
Converted backoff_test to use gunit
Diffstat (limited to 'test/core')
-rw-r--r-- | test/core/backoff/BUILD | 7 | ||||
-rw-r--r-- | test/core/backoff/backoff_test.cc | 28 |
2 files changed, 19 insertions, 16 deletions
diff --git a/test/core/backoff/BUILD b/test/core/backoff/BUILD index 4cd7acf066..6fbd6542d4 100644 --- a/test/core/backoff/BUILD +++ b/test/core/backoff/BUILD @@ -26,11 +26,14 @@ package( grpc_cc_test( name = "backoff_test", srcs = ["backoff_test.cc"], + external_deps = [ + "gtest", + ], language = "C++", deps = [ - "//:grpc", - "//test/core/util:grpc_test_util", "//:gpr", + "//:grpc", "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", ], ) diff --git a/test/core/backoff/backoff_test.cc b/test/core/backoff/backoff_test.cc index 2463556867..478d3b325d 100644 --- a/test/core/backoff/backoff_test.cc +++ b/test/core/backoff/backoff_test.cc @@ -21,12 +21,16 @@ #include <grpc/support/log.h> #include <grpc/support/useful.h> +#include <gtest/gtest.h> #include "test/core/util/test_config.h" -namespace grpc_core { +namespace grpc { +namespace testing { namespace { -static void test_constant_backoff(void) { +using grpc_core::Backoff; + +TEST(BackOffTest, ConstantBackOff) { const grpc_millis initial_backoff = 200; const double multiplier = 1.0; const double jitter = 0.0; @@ -59,7 +63,7 @@ static void test_constant_backoff(void) { grpc_exec_ctx_finish(&exec_ctx); } -static void test_min_connect(void) { +TEST(BackOffTest, MinConnect) { const grpc_millis initial_backoff = 100; const double multiplier = 1.0; const double jitter = 0.0; @@ -85,7 +89,7 @@ static void test_min_connect(void) { grpc_exec_ctx_finish(&exec_ctx); } -static void test_no_jitter_backoff(void) { +TEST(BackOffTest, NoJitterBackOff) { const grpc_millis initial_backoff = 2; const double multiplier = 2.0; const double jitter = 0.0; @@ -145,7 +149,7 @@ static void test_no_jitter_backoff(void) { grpc_exec_ctx_finish(&exec_ctx); } -static void test_jitter_backoff(void) { +TEST(BackOffTest, JitterBackOff) { const grpc_millis initial_backoff = 500; grpc_millis current_backoff = initial_backoff; const grpc_millis max_backoff = 1000; @@ -193,17 +197,13 @@ static void test_jitter_backoff(void) { } grpc_exec_ctx_finish(&exec_ctx); } + } // namespace -} // namespace grpc_core +} // namespace testing +} // namespace grpc int main(int argc, char** argv) { grpc_test_init(argc, argv); - gpr_time_init(); - - grpc_core::test_constant_backoff(); - grpc_core::test_min_connect(); - grpc_core::test_no_jitter_backoff(); - grpc_core::test_jitter_backoff(); - - return 0; + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); } |