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 @testable import TensorFlowLite
16 import XCTest
17 
18 class InterpreterOptionsTests: XCTestCase {
19 
testInterpreterOptions_InitWithDefaultValuesnull20   func testInterpreterOptions_InitWithDefaultValues() {
21     let options = InterpreterOptions()
22     XCTAssertNil(options.threadCount)
23     XCTAssertFalse(options.isErrorLoggingEnabled)
24   }
25 
testInterpreterOptions_InitWithCustomValuesnull26   func testInterpreterOptions_InitWithCustomValues() {
27     var options = InterpreterOptions()
28     options.threadCount = 2
29     XCTAssertEqual(options.threadCount, 2)
30     options.isErrorLoggingEnabled = true
31     XCTAssertTrue(options.isErrorLoggingEnabled)
32   }
33 
testInterpreterOptions_Equatablenull34   func testInterpreterOptions_Equatable() {
35     var options1 = InterpreterOptions()
36     var options2 = InterpreterOptions()
37     XCTAssertEqual(options1, options2)
38 
39     options1.threadCount = 2
40     options2.threadCount = 2
41     XCTAssertEqual(options1, options2)
42 
43     options2.threadCount = 3
44     XCTAssertNotEqual(options1, options2)
45     options2.threadCount = 2
46 
47     options1.isErrorLoggingEnabled = true
48     options2.isErrorLoggingEnabled = true
49     XCTAssertEqual(options1, options2)
50 
51     options2.isErrorLoggingEnabled = false
52     XCTAssertNotEqual(options1, options2)
53   }
54 }
55