X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=test%2Funit%2Flist%2Ftest_kv_list.h;h=5425e89f100c2c96c88a2ad80f9c1091d70ff3d7;hb=8537a90c3f99446df049ca63b4195a1c587309cc;hp=ee87209e1934b7df7176852fb5fa6c30f9b1abad;hpb=7448008aa977fe42a83738fbbc63ce11d8ab86f9;p=libcds.git diff --git a/test/unit/list/test_kv_list.h b/test/unit/list/test_kv_list.h index ee87209e..5425e89f 100644 --- a/test/unit/list/test_kv_list.h +++ b/test/unit/list/test_kv_list.h @@ -1,11 +1,11 @@ /* This file is a part of libcds - Concurrent Data Structures library - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017 Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -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. */ #ifndef CDSUNIT_LIST_TEST_KV_LIST_H @@ -57,9 +57,9 @@ namespace cds_test { s.nKey = 0; } - int key() const - { - return nKey; + int key() const + { + return nKey; } }; @@ -99,7 +99,7 @@ namespace cds_test { } }; - struct cmp + struct cmp { int operator()( key_type const& lhs, key_type const& rhs ) const { @@ -158,7 +158,6 @@ namespace cds_test { static const size_t nSize = 20; typedef typename List::key_type list_key_type; - typedef typename List::mapped_type list_mapped_type; typedef typename List::value_type list_value_type; struct key_val { int key; @@ -172,7 +171,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); // insert/find @@ -234,7 +233,7 @@ namespace cds_test { break; case 4: { - auto pair = l.update( i.key, []( bool bNew, list_value_type& n ) { + auto pair = l.update( i.key, []( bool, list_value_type& ) { ASSERT_TRUE( false ); }, false ); EXPECT_FALSE( pair.first ); @@ -268,7 +267,7 @@ namespace cds_test { EXPECT_TRUE( l.contains( i.key )); EXPECT_TRUE( l.contains( list_key_type(i.key))); EXPECT_TRUE( l.contains( other_key( i.key ), other_less())); - EXPECT_TRUE( l.find( i.key, []( list_value_type& n ) { + EXPECT_TRUE( l.find( i.key, []( list_value_type& n ) { n.second.val = n.first.nKey; } )); EXPECT_TRUE( l.find( i.key, []( list_value_type& n ) { @@ -287,10 +286,10 @@ namespace cds_test { EXPECT_TRUE( pair.first ); EXPECT_FALSE( pair.second ); - EXPECT_FALSE( l.empty() ); + EXPECT_FALSE( l.empty()); } - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); // erase @@ -323,19 +322,19 @@ namespace cds_test { EXPECT_FALSE( l.find_with( other_key( i.key ), other_less(), []( list_value_type& ) {} )); } - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // clear test - for ( auto& i : arr ) + for ( auto& i : arr ) EXPECT_TRUE( l.insert( i.key, i.val )); - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); l.clear(); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // empty list iterator test @@ -368,7 +367,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); for ( auto& i : arr ) @@ -376,8 +375,8 @@ namespace cds_test { int key = 0; for ( auto& it : l ) { - EXPECT_EQ( key, it.first.key() ); - EXPECT_EQ( it.second.val, it.first.key() ); + EXPECT_EQ( key, it.first.key()); + EXPECT_EQ( it.second.val, it.first.key()); it.second.val = it.first.key() * 10; ++key; } @@ -385,7 +384,7 @@ namespace cds_test { key = 0; for ( auto it = l.cbegin(); it != l.cend(); ++it ) { - EXPECT_EQ( key, it->first.key() ); + EXPECT_EQ( key, it->first.key()); EXPECT_EQ( it->first.key() * 10, it->second.val ); ++key; } @@ -393,7 +392,7 @@ namespace cds_test { key = 0; for ( auto it = l.begin(); it != l.end(); ++it ) { - EXPECT_EQ( key, it->first.key() ); + EXPECT_EQ( key, it->first.key()); EXPECT_EQ( it->first.key() * 10, it->second.val ); it->second.val = it->first.key() * 2; ++key; @@ -410,7 +409,7 @@ namespace cds_test { EXPECT_EQ( static_cast(key), nSize ); l.clear(); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); } };