Hashtable_UnitTests.cpp

Go to the documentation of this file.
00001 #include "Teuchos_UnitTestHarness.hpp"
00002 #include "Teuchos_as.hpp"
00003 #include "Teuchos_Hashtable.hpp"
00004 
00005 
00006 namespace {
00007 
00008 
00009 TEUCHOS_UNIT_TEST_TEMPLATE_2_DECL( Hashtable, test0, Key, Value )
00010 {
00011   using Teuchos::as;
00012 
00013   Teuchos::Hashtable<Key,Value> hashtable;
00014 
00015   hashtable.put(as<Key>(1), as<Value>(1));
00016   hashtable.put(as<Key>(3), as<Value>(9));
00017   hashtable.put(as<Key>(5), as<Value>(7));
00018 
00019   TEST_EQUALITY( hashtable.size(), 3 );
00020 
00021   TEST_EQUALITY( hashtable.containsKey(as<Key>(3)), true );
00022   TEST_EQUALITY( hashtable.containsKey(as<Key>(4)), false );
00023 
00024   TEST_EQUALITY( hashtable.get(as<Key>(5)), as<Value>(7) );
00025 }
00026 
00027 //
00028 // Instantiations
00029 //
00030 
00031 
00032 #define UNIT_TEST_GROUP( K, V ) \
00033   TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Hashtable, test0, K, V )
00034 
00035 UNIT_TEST_GROUP(int, int)
00036 UNIT_TEST_GROUP(int, float)
00037 
00038 } // namespace
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 09:57:28 2011 for Teuchos Package Browser (Single Doxygen Collection) by  doxygen 1.6.3