From 597a1487c716b799428f4b4a4903e65df4c93ba9 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 15 Sep 2008 20:03:56 +0000 Subject: Whoa! Loads of NIDS work. It actually compiles, runs, and I'm optimizing the hell out of it. Good times, everyone. This is a major chunk for congo, and the new optimizations should be good. --- src/unit/hash.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/unit') diff --git a/src/unit/hash.cpp b/src/unit/hash.cpp index 481256b..b869bdd 100644 --- a/src/unit/hash.cpp +++ b/src/unit/hash.cpp @@ -15,18 +15,22 @@ class Unit : public Bu::UnitSuite { private: typedef Bu::Hash StrIntHash; + typedef Bu::Hash StrStrHash; + public: Unit() { setName("Hash"); - addTest( Unit::test_probe ); + addTest( Unit::insert1 ); + addTest( Unit::insert2 ); + addTest( Unit::probe1 ); } virtual ~Unit() { } - void test_probe() + void probe1() { StrIntHash h; char buf[20]; @@ -38,6 +42,20 @@ public: unitTest( h.has(sTmp) ); } } + + void insert1() + { + StrIntHash h; + h["Hi"] = 42; + unitTest( h["Hi"] == 42 ); + } + + void insert2() + { + StrStrHash h; + h["Hi"] = "Yo"; + unitTest( h["Hi"].getValue() == "Yo" ); + } }; int main( int argc, char *argv[] ) -- cgit v1.2.3