Added slash command handling
This commit is contained in:
1 parent
10e9565e2e
commit
1bcadcf950
16 files changed
+567
-21
No files matched your search
@@ -0,0 +1,42 @@
|
||||
package iris.util
|
||||
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class FuzzyTest {
|
||||
@Test
|
||||
fun emptyQueryMatchesEverything() {
|
||||
assertEquals(0, fuzzyScore("", "new"))
|
||||
assertEquals(0, fuzzyScore("", ""))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun prefixMatchRanksBest() {
|
||||
assertEquals(1, fuzzyScore("mod", "model"))
|
||||
assertEquals(1, fuzzyScore("NEW", "new"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun subsequenceMatchesInOrder() {
|
||||
assertTrue(fuzzyScore("nw", "new") >= 0)
|
||||
assertTrue(fuzzyScore("mdl", "model") >= 0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun outOfOrderDoesNotMatch() {
|
||||
assertEquals(-1, fuzzyScore("wn", "new"))
|
||||
assertEquals(-1, fuzzyScore("xyz", "model"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun consecutiveRunBeatsGapped() {
|
||||
// "sta" is a consecutive run in "status"; "stu" is gapped in "status".
|
||||
assertTrue(fuzzyScore("sta", "status") < fuzzyScore("stu", "status"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun prefixBeatsSubsequence() {
|
||||
assertTrue(fuzzyScore("mod", "model") < fuzzyScore("mdl", "model"))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user