OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 |
| 13 #include "webrtc/modules/rtp_rtcp/source/ntp_time.h" |
| 14 |
| 15 namespace webrtc { |
| 16 namespace rtcp { |
| 17 |
| 18 TEST(NtpTimeTest, MidNtp) { |
| 19 const uint32_t kNtpSec = 0x12345678; |
| 20 const uint32_t kNtpFrac = 0x23456789; |
| 21 const uint32_t kNtpMid = 0x56782345; |
| 22 EXPECT_EQ(kNtpMid, NtpTime(kNtpSec, kNtpFrac).MidNtp()); |
| 23 } |
| 24 |
| 25 TEST(NtpTimeTest, NoValue) { |
| 26 NtpTime ntp; |
| 27 EXPECT_FALSE(ntp); |
| 28 EXPECT_TRUE(!ntp); |
| 29 } |
| 30 |
| 31 TEST(NtpTimeTest, HasValue) { |
| 32 const uint32_t kNtpSec = 0x12345678; |
| 33 const uint32_t kNtpFrac = 0x23456789; |
| 34 NtpTime ntp; |
| 35 ntp.Set(kNtpSec, kNtpFrac); |
| 36 EXPECT_TRUE(ntp); |
| 37 EXPECT_EQ(kNtpSec, ntp.seconds()); |
| 38 EXPECT_EQ(kNtpFrac, ntp.fractions()); |
| 39 ntp.clear(); |
| 40 EXPECT_FALSE(ntp); |
| 41 } |
| 42 |
| 43 } // namespace rtcp |
| 44 } // namespace webrtc |
OLD | NEW |