mirror of
https://github.com/mii443/AzooKeyKanaKanjiConverter.git
synced 2025-08-22 15:05:26 +00:00
feat: getLOUDSData関数をgetLOUDSDataInRange関数に統合。最適化を行っていない実装にもかかわらず、従来実装の1.2倍程度の高速化効果が得られる
This commit is contained in:
@ -129,7 +129,7 @@ final class DicdataStoreTests: XCTestCase {
|
||||
for (key, word) in mustWords {
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition(key, inputStyle: .direct)
|
||||
let result = dicdataStore.getLOUDSData(inputData: c, from: 0, to: c.input.endIndex - 1, needTypoCorrection: false)
|
||||
let result = dicdataStore.getLOUDSDataInRange(inputData: c, from: 0, toIndexRange: c.input.endIndex - 1 ..< c.input.endIndex, needTypoCorrection: false)
|
||||
// 冗長な書き方だが、こうすることで「どの項目でエラーが発生したのか」がはっきりするため、こう書いている。
|
||||
XCTAssertEqual(result.first(where: {$0.data.word == word})?.data.word, word)
|
||||
}
|
||||
@ -150,7 +150,7 @@ final class DicdataStoreTests: XCTestCase {
|
||||
for (key, word) in mustWords {
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition(key, inputStyle: .direct)
|
||||
let result = dicdataStore.getLOUDSData(inputData: c, from: 0, to: c.input.endIndex - 1, needTypoCorrection: false)
|
||||
let result = dicdataStore.getLOUDSDataInRange(inputData: c, from: 0, toIndexRange: c.input.endIndex - 1 ..< c.input.endIndex, needTypoCorrection: false)
|
||||
XCTAssertNil(result.first(where: {$0.data.word == word && $0.data.ruby == key}))
|
||||
}
|
||||
}
|
||||
@ -170,7 +170,7 @@ final class DicdataStoreTests: XCTestCase {
|
||||
for (key, word) in mustWords {
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition(key, inputStyle: .direct)
|
||||
let result = dicdataStore.getLOUDSData(inputData: c, from: 0, to: c.input.endIndex - 1, needTypoCorrection: true)
|
||||
let result = dicdataStore.getLOUDSDataInRange(inputData: c, from: 0, toIndexRange: c.input.endIndex - 1 ..< c.input.endIndex, needTypoCorrection: true)
|
||||
XCTAssertEqual(result.first(where: {$0.data.word == word})?.data.word, word)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user