Fix matching empty string with empty trie

Doing so caused segmentation fault. This patch also adds an unit
test for the trie object.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>