blob: 9244c5ba295261648576c7a764cd75f3f8ce5353 [file] [log] [blame]
Steve Antond295e402017-07-14 16:06:41 -07001/*
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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020013#include "rtc_base/gunit.h"
Steve Antond295e402017-07-14 16:06:41 -070014
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020015#import "api/peerconnection/RTCIntervalRange+Private.h"
16#import "api/peerconnection/RTCIntervalRange.h"
Steve Antond295e402017-07-14 16:06:41 -070017
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
48TEST(RTCIntervalRangeTest, NativeConfigurationConversionTest) {
49 @autoreleasepool {
50 RTCIntervalRangeTest *test = [[RTCIntervalRangeTest alloc] init];
51 [test testConversionToNativeConfiguration];
52 [test testNativeConversionToConfiguration];
53 }
54}