OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2017 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 #import <Foundation/Foundation.h> |
| 12 |
| 13 #include "webrtc/rtc_base/gunit.h" |
| 14 |
| 15 #import "RTCIntervalRange+Private.h" |
| 16 #import "WebRTC/RTCIntervalRange.h" |
| 17 |
| 18 @interface RTCIntervalRangeTest : NSObject |
| 19 - (void)testConversionToNativeConfiguration; |
| 20 - (void)testNativeConversionToConfiguration; |
| 21 @end |
| 22 |
| 23 @implementation RTCIntervalRangeTest |
| 24 |
| 25 - (void)testConversionToNativeConfiguration { |
| 26 NSInteger min = 0; |
| 27 NSInteger max = 100; |
| 28 RTCIntervalRange *range = [[RTCIntervalRange alloc] initWithMin:min max:max]; |
| 29 EXPECT_EQ(min, range.min); |
| 30 EXPECT_EQ(max, range.max); |
| 31 std::unique_ptr<rtc::IntervalRange> nativeRange = range.nativeIntervalRange; |
| 32 EXPECT_EQ(min, nativeRange->min()); |
| 33 EXPECT_EQ(max, nativeRange->max()); |
| 34 } |
| 35 |
| 36 - (void)testNativeConversionToConfiguration { |
| 37 NSInteger min = 0; |
| 38 NSInteger max = 100; |
| 39 rtc::IntervalRange nativeRange((int)min, (int)max); |
| 40 RTCIntervalRange *range = |
| 41 [[RTCIntervalRange alloc] initWithNativeIntervalRange:nativeRange]; |
| 42 EXPECT_EQ(min, range.min); |
| 43 EXPECT_EQ(max, range.max); |
| 44 } |
| 45 |
| 46 @end |
| 47 |
| 48 TEST(RTCIntervalRangeTest, NativeConfigurationConversionTest) { |
| 49 @autoreleasepool { |
| 50 RTCIntervalRangeTest *test = [[RTCIntervalRangeTest alloc] init]; |
| 51 [test testConversionToNativeConfiguration]; |
| 52 [test testNativeConversionToConfiguration]; |
| 53 } |
| 54 } |
OLD | NEW |