LCOV - code coverage report
Current view: top level - tests/vtree - vtree_count_suite.cpp (source / functions) Hit Total Coverage
Test: v-set-coverage.info Lines: 24 24 100.0 %
Date: 2019-09-12 Functions: 10 10 100.0 %

          Line data    Source code
       1             : //
       2             : // Author: Saprykin Dmitry <saprykin.dmitry@gmail.com>, (C) 2014
       3             : //
       4             : // Copyright: See COPYING file that comes with this distribution
       5             : //
       6             : 
       7             : #include <fas/testing.hpp>
       8             : #include <vset/vtree/vtree.hpp>
       9             : #include <vset/vtree/strategy.hpp>
      10             : 
      11           3 : UNIT(vtree_count, "")
      12             : {
      13             :   using namespace fas::testing;
      14             :   using namespace vset;
      15             : 
      16             :   typedef vtree::vtree< vtree::strategy::vtree_fsb_inmem<int, std::less<int>, 3> > int_vtree;
      17             : 
      18           1 :   int_vtree tree;
      19             :   //({1,2,2,3,6,7,9,15});
      20           1 :   tree.insert(1);tree.insert(2);tree.insert(2);tree.insert(3);tree.insert(6);tree.insert(7);tree.insert(9);tree.insert(15);
      21             : 
      22           1 :   t << equal<expect, typename int_vtree::size_type>( tree.count(1), static_cast< typename int_vtree::size_type>(1) ) << FAS_TESTING_FILE_LINE;
      23           1 :   t << equal<expect, typename int_vtree::size_type>( tree.count(2), static_cast< typename int_vtree::size_type>(2) ) << FAS_TESTING_FILE_LINE;
      24           1 :   t << equal<expect, typename int_vtree::size_type>( tree.count(-5), static_cast< typename int_vtree::size_type>(0) ) << FAS_TESTING_FILE_LINE;
      25           1 :   t << equal<expect, typename int_vtree::size_type>( tree.count(6), static_cast< typename int_vtree::size_type>(1) ) << FAS_TESTING_FILE_LINE;
      26           1 :   t << equal<expect, typename int_vtree::size_type>( tree.count(11), static_cast< typename int_vtree::size_type>(0) ) << FAS_TESTING_FILE_LINE;
      27           1 :   t << equal<expect, typename int_vtree::size_type>( tree.count(15), static_cast< typename int_vtree::size_type>(1) ) << FAS_TESTING_FILE_LINE;
      28           1 :   t << equal<expect, typename int_vtree::size_type>( tree.count(18), static_cast< typename int_vtree::size_type>(0) ) << FAS_TESTING_FILE_LINE;
      29             : 
      30           1 :   t << equal<expect, typename int_vtree::size_type>( tree.capacity(), static_cast< typename int_vtree::size_type>(18) ) << FAS_TESTING_FILE_LINE;
      31             : 
      32           2 :   int_vtree tree1;
      33           1 :   tree1.insert(1);
      34           1 :   t << equal<expect, typename int_vtree::size_type>( tree1.capacity(), static_cast< typename int_vtree::size_type>(3) ) << FAS_TESTING_FILE_LINE;
      35             : 
      36           1 :   tree1.insert(544);
      37           1 :   t << equal<expect, typename int_vtree::size_type>( tree1.capacity(), static_cast< typename int_vtree::size_type>(3) ) << FAS_TESTING_FILE_LINE;
      38             : 
      39           1 :   tree1.insert(545);
      40           1 :   t << equal<expect, typename int_vtree::size_type>( tree1.capacity(), static_cast< typename int_vtree::size_type>(3) ) << FAS_TESTING_FILE_LINE;
      41             : 
      42           1 :   tree1.insert(546);
      43           1 :   t << equal<expect, typename int_vtree::size_type>( tree1.capacity(), static_cast< typename int_vtree::size_type>(6) ) << FAS_TESTING_FILE_LINE;
      44             : 
      45           2 :   t << nothing;
      46           1 : }
      47             : 
      48           1 : BEGIN_SUITE(vtree_count_suite, "")
      49             :   ADD_UNIT(vtree_count)
      50           7 : END_SUITE(vtree_count_suite)

Generated by: LCOV version 1.10