vChewing-macOS/Packages/vChewing_CandidateWindow/Tests/CandidateWindowTests/CandidatePoolTests.swift

48 lines
1.5 KiB
Swift

// (c) 2022 and onwards The vChewing Project (MIT-NTL License).
// ====================
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
// ... with NTL restriction stating that:
// No trademark license is granted to use the trade names, trademarks, service
// marks, or product names of Contributor, except as required to fulfill notice
// requirements defined in MIT License.
import Cocoa
import XCTest
@testable import CandidateWindow
final class CandidatePoolTests: XCTestCase {
let testCandidates: [String] = [
"二十四歲是學生", "二十四歲", "昏睡紅茶", "食雪漢", "意味深", "學生", "便乗",
"迫真", "驚愕", "論證", "正論", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "便", "",
"", "", "",
]
func testPoolHorizontal() throws {
let pool = CandidatePool(candidates: testCandidates, selectionKeys: "123456", layout: .horizontal)
var strOutput = ""
pool.candidateLines.forEach {
$0.forEach {
strOutput += $0.displayedText + ", "
}
strOutput += "\n"
}
print("The matrix:")
print(strOutput)
}
func testPoolVertical() throws {
let pool = CandidatePool(candidates: testCandidates, selectionKeys: "123456", layout: .vertical)
var strOutput = ""
pool.candidateLines.forEach {
$0.forEach {
strOutput += $0.displayedText + ", "
}
strOutput += "\n"
}
print("The matrix:")
print(strOutput)
}
}