anchor.diff:      error = trie:find_prefix("aacX", RootNode0),
       {97,97,{{{97,98,{{{98,99,{{"cde",3},{[],2}}},error},{"cdefghijklmnopqrstuvwxyz",1}}},error}}} =
           RootNode1 = trie:store("aabcde", 3, RootNode0),
  +    {97,97,{{{97,98,{{{98,99,{{"cde",13},{[],12}}},error},{"cdefghijklmnopqrstuvwxyz",11}}},error}}} =
  +        map(fun(_, V) -> V + 10 end, RootNode1),
  +    {97,97,{{{97,98,{{{98,99,{{[],error},{[],error}}},error},{"cdefghijklmnopqrstuvwxyz",1}}},error}}} =
  +        filter(fun(_, V) -> V =< 1 end, RootNode1),
  +    {97,97,{{{97,98,{{{98,99,{{[],error},{[],2}}},error},{"cdefghijklmnopqrstuvwxyz",1}}},error}}} =
  +        filter(fun(_, V) -> V =< 2 end, RootNode1),
  +    ["aabcde", "aac", "abcdefghijklmnopqrstuvwxyz"] =
  +        trie:fetch_keys(RootNode1),
  +    [{"aabcde", 3}, {"aac", 2}, {"abcdefghijklmnopqrstuvwxyz", 1}] =
  +        trie:to_list(RootNode1),
  +    [{"aabcde", 3}, {"aac", 12}, {"abcdefghijklmnopqrstuvwxyz", 1}] =
  +        trie:to_list(trie:update("aac", fun(I) -> I + 10 end, RootNode1)),
  +    [{"aaa", 4}, {"aabcde", 3}, {"aac", 2}, {"abcdefghijklmnopqrstuvwxyz", 1}] =
  +        trie:to_list(trie:update("aaa", fun(I) -> I + 10 end, 4, RootNode1)),
  +    6 = foldl(fun(_, I, A) -> I + A end, 0, RootNode1),
  +    [{"aabcde", 3},{"aac", 2},{"abcdefghijklmnopqrstuvwxyz", 1}] =
  +        foldr(fun(K, V, A) -> [{K,V} | A] end, [], RootNode1),
  +    [{"abcdefghijklmnopqrstuvwxyz", 1}, {"aac", 2}, {"aabcde", 3}] =
  +        foldl(fun(K, V, A) -> [{K,V} | A] end, [], RootNode1),
       error = trie:find("aabcde", RootNode0),
       3 = trie:find("aabcde", RootNode1),
  +    RootNode2 = trie:erase("aac", RootNode0),
  +    1 = trie:find("abcdefghijklmnopqrstuvwxyz", RootNode2),
  +    {97,98,{{{98,98,{{[],[2]}}},[1]},{"c",[3]}}} =
  +        RootNode3 = trie:new([{"a", [1]},{"ab", [2]},{"bc", [3]}]),
  +    {97,98,{{{98,98,{{[],[2]}}},[1,2]},{"c",[3]}}} =
  +        trie:append("a", 2, RootNode3),
  +
  +    RootNode4 = trie:new([
  +        {"ammmmmmm",      7},
  +        {"aaaaaaaaaaa",   4},
  +        {"aaa",           2},
  +        {"ab",            0},
  +        {"ab",            5},
  +        {"aa",            1},
  +        {"aba",           6},
  +        {"aaaaaaaa",      3}]),
  +    {97,97,
  +     {{{97,109,
  +        {{{97,97,
  +           {{{97,97,
  +              {{{97,97,
  +                 {{{97,97,
  +                    {{{97,97,
  +                       {{{97,97,
  +                          {{{97,97,
  +                             {{"aa",4}}},
  +                            3}}},
  +                         error}}},
  +                     error}}},
  +                   error}}},
  +                error}}},
  +             2}}},
  +          1},
  +         {{97,97,{{[],6}}},5},
  +         {[],error},
  +         {[],error},
  +         {[],error},
  +         {[],error},
  +         {[],error},
  +         {[],error},
  +         {[],error},
  +         {[],error},
  +         {[],error},
  +         {[],error},
  +         {"mmmmmm",7}}},
  +       error}}} = RootNode4,
  +    [{"aa",1},
  +     {"aaa",2},
  +     {"aaaaaaaa",3},
  +     {"aaaaaaaaaaa",4},
  +     {"ab",5},
  +     {"aba",6},
  +     {"ammmmmmm",7}] = trie:to_list(trie:from_list(trie:to_list(RootNode4))),
  +    % trie:map happens to go through in reverse order
  +    ["aa",
  +     "aaa",
  +     "aaaaaaaa",
  +     "aaaaaaaaaaa",
  +     "ab",
  +     "aba",
  +     "ammmmmmm"] = trie:fetch_keys(RootNode4),
  +    ["aa",
  +     "aaa",
  +     "aaaaaaaa",
  +     "aaaaaaaaaaa",
  +     "ab",
  +     "aba",
  +     "ammmmmmm"] = trie:foldr(fun(Key, _, L) -> [Key | L] end, [], RootNode4),
  +    ["ammmmmmm",
  +     "aba",
  +     "ab",
  +     "aaaaaaaaaaa",
  +     "aaaaaaaa",
  +     "aaa",
  +     "aa"] = trie:foldl(fun(Key, _, L) -> [Key | L] end, [], RootNode4),
  +    RootNode5 = trie:store("a", 0, trie:store("aaaa", 2.5, RootNode4)),
  +    2.5 = trie:find("aaaa", RootNode5),
  +    error = trie:find("aaaa", RootNode4),
  +    2.5 = trie:find_prefix("aaaa", RootNode5),
  +    prefix = trie:find_prefix("aaaa", RootNode4),
  +    2.5 = trie:fetch("aaaa", RootNode5),
  +    {'EXIT', {if_clause, _}} = (catch trie:fetch("aaaa", RootNode4)),
  +    RootNode4 = trie:erase("a", trie:erase("aaaa", RootNode5)),
  +    true = trie:is_key("aaaa", RootNode5),
  +    false = trie:is_key("aaaa", RootNode4),
       ok.
   
   %%-------------------------------------------------------------------------
  
positive.code: %%% DAMAGE.
  %%%
  %%% @author Michael Truog <mjtruog [at] gmail (dot) com>
  %%% @copyright 2010 Michael Truog
  %%% @version 0.0.1 {@date} {@time}
  %%%------------------------------------------------------------------------
  
  -module(trie).
  -author('mjtruog [at] gmail (dot) com').
  
  %% external interface
  -export([new/0,
           new/1,
           find/2,
           find_prefix/2,
           store/2,
           store/3,
           test/0,
           test_size/0,
           test_size/1]).
  
negative.code: %%%
  %%% BSD LICENSE
  %%% 
  %%% Copyright (c) 2010-2011, Michael Truog <mjtruog at gmail dot com>
  %%% All rights reserved.
  %%% 
  %%% Redistribution and use in source and binary forms, with or without
  