From 4b04e3893a098044b4f46dbff0ff060260e86ca6 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 29 Nov 2017 17:58:59 -0800 Subject: 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 Maintainer: Gabe Black --- src/base/trie.hh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/base/trie.hh') diff --git a/src/base/trie.hh b/src/base/trie.hh index e6b2881ab..1d110b4e1 100644 --- a/src/base/trie.hh +++ b/src/base/trie.hh @@ -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) -- cgit v1.2.3