//
//  Created by Andrew Podkovyrin
//  Copyright © 2020 Andrew Podkovyrin. All rights reserved.
//
//  Licensed under the MIT License (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//  https://opensource.org/licenses/MIT
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//

@testable import DeepL

import XCTest

// swiftlint:disable all

class TextSplitTests: XCTestCase {
    private let text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Mauris nunc congue nisi vitae suscipit tellus mauris a. Sed augue lacus viverra vitae congue eu consequat ac."

    func testSplitText() {
        let splitter = TextTokenizationSplitter(text: text,
                                                maxTextLength: (text as NSString).length / 2,
                                                errorPercent: 0.1)
        let result = splitter.split()
        XCTAssert(result.count == 2)
    }

    func testNotSplittingText() {
        let splitter = TextTokenizationSplitter(text: text,
                                                maxTextLength: (text as NSString).length,
                                                errorPercent: 0.0)
        let result = splitter.split()
        XCTAssert(result.count == 1)
    }
}
