Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
romanmazeev committed Feb 26, 2025
1 parent c682333 commit 10bb06b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
38 changes: 38 additions & 0 deletions Tests/MRZScannerTests/Private/BoundingRectConverterTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// BoundingRectConverterTests.swift
//
//
// Created by Roman Mazeev on 01/12/2023.
//

@testable import MRZScanner
import XCTest

final class BoundingRectConverterTests: XCTestCase {
func testConverterEmpty() {
let result = BoundingRectConverter.liveValue.convert([], [])
XCTAssert(result.valid.isEmpty)
XCTAssert(result.invalid.isEmpty)
}

func testConverter() {
let firstResult = TextRecognizer.Result(results: ["test"], boundingRect: .init(x: 0, y: 0, width: 20, height: 20))
let secondResult = TextRecognizer.Result(results: ["test"], boundingRect: .zero)
let thirdResult = TextRecognizer.Result(results: ["test"], boundingRect: .init(x: 1, y: 1, width: 40, height: 60))

let result = BoundingRectConverter.liveValue.convert(
[
firstResult,
secondResult,
thirdResult
],
[
Validator.Result(result: "test", index: 0),
Validator.Result(result: "test", index: 1),
Validator.Result(result: "test", index: 1)
]
)
XCTAssertEqual(result.valid, [firstResult.boundingRect, secondResult.boundingRect])
XCTAssertEqual(result.invalid, [thirdResult.boundingRect])
}
}
2 changes: 1 addition & 1 deletion Tests/MRZScannerTests/Private/TrackerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@testable import MRZScanner
import XCTest

final class TrackerCreatorTests: XCTestCase {
final class TrackerTests: XCTestCase {
func testTrackAndCurrentResults() throws {
let tracker = Tracker.liveValue.create()

Expand Down

0 comments on commit 10bb06b

Please sign in to comment.