Fix suffix tree, add testing suite.

Signed-off-by: Andrew Tselischev <andrewtselischev@gmail.com>