[Agent][Bastion] - Bastion mode - 2
This commit is contained in:
21
agent-go/a_init/bastion_init/TrieSearch_test.go
Normal file
21
agent-go/a_init/bastion_init/TrieSearch_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package bastion_init
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewTrie(t *testing.T) {
|
||||
|
||||
words := []string{"apple", "apricot", "apprentice", "application"}
|
||||
tcc := NewTrie()
|
||||
tcc.InsertAll(words)
|
||||
|
||||
prefix := "ap"
|
||||
closest, err := FindClosestWord(tcc, prefix)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
} else {
|
||||
fmt.Printf("The closest word to '%s' is '%s'\n", prefix, closest)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user