tmud-3.0.0/benchmark/
tmud-3.0.0/cmd/
tmud-3.0.0/cmd/objects/
tmud-3.0.0/cmd/tiny/
tmud-3.0.0/doc/SQLite/
tmud-3.0.0/doc/SQLite3/
tmud-3.0.0/doc/TernaryTrie/
tmud-3.0.0/farts/
tmud-3.0.0/lib/
tmud-3.0.0/lib/engine/
tmud-3.0.0/lib/farts/
tmud-3.0.0/logs/
# Code Generated by ZenTest v. 2.3.0
#                 classname: asrt / meth =  ratio%
#               TernaryTrie:   11 /    5 = 220.00%

unless defined? $ZENTEST and $ZENTEST
require 'test/unit'
require 'utility/ternarytrie'
end

class TestTernaryTrie < Test::Unit::TestCase
  def setup
    @t = TernaryTrie.new
  end

  def test_find
    assert(true, @t.insert("two", 2))
    assert(true, @t.insert("three", 3))
    assert_equal([3,2], @t.find("t"))
    assert_equal([2], @t.find("tw"))
    assert_equal([], @t.find("o"))
  end

  def test_find_exact
    assert(true, @t.insert("one", 1))
    assert_equal(1, @t.find_exact("one"))
    assert_equal(nil, @t.find_exact("two"))
  end

  def test_insert
    assert(true, @t.insert("one", 1))
    assert_equal(1, @t.find_exact("one"))
  end

  def test_to_hash
    assert(true, @t.insert("one", 1))
    assert(true, @t.insert("two", 2))
    assert(true, @t.insert("three", 3))
    assert_equal({"one" => 1, "two" => 2, "three" => 3},
      @t.to_hash)
  end
end