diff options
author | yang-g <yangg@google.com> | 2017-03-28 21:41:02 -0700 |
---|---|---|
committer | yang-g <yangg@google.com> | 2017-03-28 21:41:02 -0700 |
commit | 1aba869e9e3046766cab8744a028a20a8af62dd2 (patch) | |
tree | 23b1df39a97c07c50cd46d7a20f438af7499babc /test/core/support | |
parent | 0ce1bb03e36e977224d3e6b9e96da5a2ec0847e6 (diff) |
Make convert clock_type consistent with add/sub when dealing with extreme values
Diffstat (limited to 'test/core/support')
-rw-r--r-- | test/core/support/time_test.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/core/support/time_test.c b/test/core/support/time_test.c index e9ca08d041..73e43caa69 100644 --- a/test/core/support/time_test.c +++ b/test/core/support/time_test.c @@ -255,6 +255,14 @@ static void test_similar(void) { gpr_time_from_micros(10, GPR_TIMESPAN))); } +static void test_convert_extreme(void) { + gpr_timespec realtime_t = {INT64_MAX, 1, GPR_CLOCK_REALTIME}; + gpr_timespec monotime_t = + gpr_convert_clock_type(realtime_t, GPR_CLOCK_MONOTONIC); + GPR_ASSERT(monotime_t.tv_sec == realtime_t.tv_sec); + GPR_ASSERT(monotime_t.clock_type == GPR_CLOCK_MONOTONIC); +} + int main(int argc, char *argv[]) { grpc_test_init(argc, argv); @@ -263,5 +271,6 @@ int main(int argc, char *argv[]) { test_overflow(); test_sticky_infinities(); test_similar(); + test_convert_extreme(); return 0; } |