tests: Remove trietest's dependence on cprintf.

Dumping the structure of the tries being constructed was useful for
debugging when the trie data structure was being developed, but the
output can't be automatically verified easily, and what's considered
correct depends on the specific implementation of the trie itself.

To make some of the earlier tests more meaningful, additional lookups
were added which verified that the correct values were returned when
the nodes of the trie were in particular arrangements.

Change-Id: Ib464ad1804d13fe40882da2190d7bf452da83818
Reviewed-on: https://gem5-review.googlesource.com/6223
Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
Maintainer: Gabe Black <gabeblack@google.com>
This commit is contained in:
Gabe Black
2017-11-29 17:58:59 -08:00
parent b359faa73b
commit 4b04e3893a
2 changed files with 14 additions and 19 deletions

View File

@@ -185,6 +185,10 @@ class Trie
Handle
insert(Key key, unsigned width, Value *val)
{
// We use NULL value pointers to mark internal nodes of the trie, so
// we don't allow inserting them as real values.
assert(val);
// Build a mask which masks off all the bits we don't care about.
Key new_mask = ~(Key)0;
if (width < MaxBits)