Migrated set-insDelFind stress test to gtest framework
[libcds.git] / test / stress / set / set_type.h
index 3d84ff2f6b12885edd5017a21070f914bd558385..2c524ed500734cceb029828f744e9d107cc5376c 100644 (file)
@@ -83,6 +83,17 @@ namespace set {
     CDSUNIT_INT_COMPARE(unsigned long long);
 #undef CDSUNIT_INT_COMPARE
 
+#define CDSUNIT_INT_LESS(t)  template <> struct less<t> { bool operator()( t k1, t k2 ){ return k1 < k2; } }
+    CDSUNIT_INT_LESS( char );
+    CDSUNIT_INT_LESS( unsigned char );
+    CDSUNIT_INT_LESS( int );
+    CDSUNIT_INT_LESS( unsigned int );
+    CDSUNIT_INT_LESS( long );
+    CDSUNIT_INT_LESS( unsigned long );
+    CDSUNIT_INT_LESS( long long );
+    CDSUNIT_INT_LESS( unsigned long long );
+#undef CDSUNIT_INT_LESS
+
     template <>
     struct cmp<std::string>
     {
@@ -100,6 +111,36 @@ namespace set {
         }
     };
 
+    template <typename T>
+    struct hash
+    {
+        typedef size_t result_type;
+        typedef T      argument_type;
+
+        size_t operator()( T const& k ) const
+        {
+            return std::hash<size_t>()(k.nKey);
+        }
+
+        size_t operator()( size_t k ) const
+        {
+            return std::hash<size_t>()(k);
+        }
+    };
+
+    template <>
+    struct hash<size_t>
+    {
+        typedef size_t result_type;
+        typedef size_t argument_type;
+
+        size_t operator()( size_t k ) const
+        {
+            return std::hash<size_t>()(k);
+        }
+    };
+
+
     // forward
     template <typename ImplSelector, typename Key, typename Value>
     struct set_type;