1 // Copyright 2018 Google Inc. All rights reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at: 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #import "tensorflow/lite/experimental/objc/apis/TFLQuantizationParameters.h" 16 17 #import <XCTest/XCTest.h> 18 19 #import "tensorflow/lite/experimental/objc/sources/TFLQuantizationParameters+Internal.h" 20 21 NS_ASSUME_NONNULL_BEGIN 22 23 /** Test scale of quantization parameters. */ 24 static const float kTestScale = 2.0; 25 26 /** Test zero point of quantization parameters. */ 27 static const int32_t kTestZeroPoint = 128; 28 29 /** 30 * Unit tests for TFLQuantizationParameters. 31 */ 32 @interface TFLQuantizationParametersTests : XCTestCase 33 @end 34 35 @implementation TFLQuantizationParametersTests 36 37 #pragma mark - Tests 38 39 - (void)testInitWithScaleAndZeroPoint { 40 TFLQuantizationParameters *params = 41 [[TFLQuantizationParameters alloc] initWithScale:kTestScale zeroPoint:kTestZeroPoint]; 42 XCTAssertEqual(params.scale, kTestScale); 43 XCTAssertEqual(params.zeroPoint, kTestZeroPoint); 44 } 45 46 @end 47 48 NS_ASSUME_NONNULL_END 49