diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-06-14 19:10:28 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-07-31 16:36:40 +0200 |
commit | 85d3b34ed2c3b627fca50c82abe426b7239b62a3 (patch) | |
tree | 3e00c4841a917432e504d2d1ba7ac6b9fd3bc258 /openbsc/tests/testsuite.at | |
parent | b718ad397e9edc9311d960a93feb6bc3a5bbb2a7 (diff) |
nat: Introduce a prefix lookup tree (trie) for number rewriting
* It is a trie. The max depth of the trie is the length of the
longest prefix. The lookup is O(lookuped_prefix), but as the prefix
length is limited, the lookup time is constant.
* Each node can hold the entire prefix, has place for the rewrite
rule with up to three digits.
* A trie with 20k entries will take about 3MB ram.
* Filling the trie 100 times takes ~800ms on my i7 laptop
* 10.000.000 lookups take 315ms.. (for the same prefix).
* 93/99 lines are tested, 6/6 functions are tested, 49 of 54 branches
are tested. Only memory allocation failures are not covered
* A late addition is to handle the '+' sign and to increase the number
of chars in the rewrite prefix. The timing/line coverage has not
been updated after this change.
Diffstat (limited to 'openbsc/tests/testsuite.at')
-rw-r--r-- | openbsc/tests/testsuite.at | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/openbsc/tests/testsuite.at b/openbsc/tests/testsuite.at index ea3fa1ce5..148b3d369 100644 --- a/openbsc/tests/testsuite.at +++ b/openbsc/tests/testsuite.at @@ -48,6 +48,14 @@ cat $abs_srcdir/smpp/smpp_test.err > experr AT_CHECK([$abs_top_builddir/tests/smpp/smpp_test], [], [expout], [experr]) AT_CLEANUP +AT_SETUP([bsc-nat-trie]) +AT_KEYWORDS([bsc-nat-trie]) +AT_CHECK([test "$enable_nat_test" != no || exit 77]) +cp $abs_srcdir/bsc-nat-trie/prefixes.csv . +cat $abs_srcdir/bsc-nat-trie/bsc_nat_trie_test.ok > expout +AT_CHECK([$abs_top_builddir/tests/bsc-nat-trie/bsc_nat_trie_test], [], [expout], [ignore]) +AT_CLEANUP + AT_SETUP([si]) AT_KEYWORDS([si]) cat $abs_srcdir/si/si_test.ok > expout |