@Test
public void testTeraCommands() {
List<String> commands = ImmutableList.of("azerty", "bindKey", "clearChunkCache", "countAI",
"damage", "debugTarget", "destroyAI", "destroyEntitiesUsingPrefab", "dumpEntities",
"exit", "fullscreen", "generateNameList", "generateNameList", "ghost", "giveBlock",
"giveBlock", "giveItem", "health", "help", "hjump", "hspeed", "initNameGenerator",
"kill", "listBlocks", "listBlocksByCategory", "listFreeShapeBlocks", "listItems",
"listShapes", "mute", "neo", "nextName", "placeBlock", "playTestSound", "purgeWorld",
"restoreSpeed", "say", "setGroundFriction", "setJumpSpeed", "setMaxGhostSpeed",
"setMaxGroundSpeed", "setMaxHealth", "setRegenRaterate", "showHealth", "showMovement",
"sleigh", "spawnBlock", "spawnPrefab", "stepHeight", "teleport");
List<String> noHitQueries = ImmutableList.of("asdfd", "AvDS", "MPRString");
for (String query : noHitQueries) {
Collection<String> matches = CamelCaseMatcher.getMatches(query, commands, true);
assertTrue("The query '" + query + "' should not match any command", matches.size() == 0);
}
List<String> oneHitQueries = ImmutableList.of("liFSB", "puW", "liI");
for (String query : oneHitQueries) {
Collection<String> matches = CamelCaseMatcher.getMatches(query, commands, true);
assertTrue("The query '" + query + "' should match exactly 1 command, not " + matches.size(), matches.size() == 1);
}
List<String> multiHitQueries = ImmutableList.of("liB", "spa", "seMaGSpe");
for (String query : multiHitQueries) {
Collection<String> matches = CamelCaseMatcher.getMatches(query, commands, true);
assertTrue("The query '" + query + "' should match multiple commands, not " + matches.size(), matches.size() > 1);
}
}