aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/backoff/backoff_test.cc
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2017-11-29 13:33:39 -0800
committerGravatar David Garcia Quintas <dgq@google.com>2017-11-29 13:33:39 -0800
commit2258cd7ddc50b84d1c5589be99fad2c4278707b9 (patch)
tree26363a7f61e7f99544aa3fac49f0df9f2fdd42dc /test/core/backoff/backoff_test.cc
parentd3f6eae6694189bc9547acc6a95f9c94add4508b (diff)
Converted backoff_test to use gunit
Diffstat (limited to 'test/core/backoff/backoff_test.cc')
-rw-r--r--test/core/backoff/backoff_test.cc28
1 files changed, 14 insertions, 14 deletions
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();
}