Added internal statistics for LazyList
[libcds.git] / test / unit / list / intrusive_lazy_hp.cpp
index bddb5d4cf6621acb8a92e4609626648529365154..bf3d49b5e1a75df88ccb43fe59e04f520447de94 100644 (file)
@@ -25,7 +25,7 @@
     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 #include "test_intrusive_list_hp.h"
@@ -167,6 +167,41 @@ namespace {
         test_hp( l );
     }
 
+    TEST_F( IntrusiveLazyList_HP, base_hook_stat )
+    {
+        struct traits: public ci::lazy_list::traits {
+            typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+            typedef mock_disposer disposer;
+            typedef cmp< base_item > compare;
+            typedef intrusive_list_common::less< base_item > less;
+            typedef cds::atomicity::item_counter item_counter;
+            typedef cds::intrusive::lazy_list::stat<> stat;
+        };
+        typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+        list_type l;
+        test_common( l );
+        test_ordered_iterator( l );
+        test_hp( l );
+    }
+
+    TEST_F( IntrusiveLazyList_HP, base_hook_wrapped_stat )
+    {
+        struct traits: public ci::lazy_list::traits {
+            typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+            typedef mock_disposer disposer;
+            typedef cmp< base_item > compare;
+            typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
+        };
+        typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+        cds::intrusive::lazy_list::stat<> st;
+        list_type l( st );
+        test_common( l );
+        test_ordered_iterator( l );
+        test_hp( l );
+    }
+
     TEST_F( IntrusiveLazyList_HP, member_hook )
     {
         typedef ci::LazyList< gc_type, member_item,
@@ -270,4 +305,39 @@ namespace {
         test_hp( l );
     }
 
+    TEST_F( IntrusiveLazyList_HP, member_hook_stat )
+    {
+        struct traits: public ci::lazy_list::traits {
+            typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+            typedef mock_disposer disposer;
+            typedef cmp< member_item > compare;
+            typedef intrusive_list_common::less< member_item > less;
+            typedef cds::atomicity::item_counter item_counter;
+            typedef cds::intrusive::lazy_list::stat<> stat;
+        };
+        typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+        list_type l;
+        test_common( l );
+        test_ordered_iterator( l );
+        test_hp( l );
+    }
+
+    TEST_F( IntrusiveLazyList_HP, member_hook_wrapped_stat )
+    {
+        struct traits: public ci::lazy_list::traits {
+            typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+            typedef mock_disposer disposer;
+            typedef cmp< member_item > compare;
+            typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
+        };
+        typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+        cds::intrusive::lazy_list::stat<> st;
+        list_type l( st );
+        test_common( l );
+        test_ordered_iterator( l );
+        test_hp( l );
+    }
+
 } // namespace