From 95b2eaedf9f330cc853c191096aafec27b92d24b Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Thu, 13 Apr 2017 09:14:56 +0200 Subject: [PATCH] drop couts from SparseBoolVectorTest --- .../test-src/common/SparseBoolVectorTest.cpp | 129 ++---------------- .../test-src/common/SparseBoolVectorTest.h | 4 - 2 files changed, 13 insertions(+), 120 deletions(-) diff --git a/alib2data/test-src/common/SparseBoolVectorTest.cpp b/alib2data/test-src/common/SparseBoolVectorTest.cpp index d7711a2e48..6100df69f9 100644 --- a/alib2data/test-src/common/SparseBoolVectorTest.cpp +++ b/alib2data/test-src/common/SparseBoolVectorTest.cpp @@ -47,116 +47,13 @@ void SparseBoolVectorTest::testVectorCompatibility() { common::SparseBoolVector compressed ( orig ); std::vector < bool > copy ( compressed ); - std::cout << orig << std::endl; +/* std::cout << orig << std::endl; std::cout << copy << std::endl; - std::cout << compressed.data ( ) << std::endl; + std::cout << compressed.data ( ) << std::endl;*/ CPPUNIT_ASSERT ( orig == copy ); } -void testOffset ( int /* offset */ ) { -/* unsigned long long shadow = 0x2A76B147D6521C87ULL; - std::vector < bool > data; - - for ( unsigned i = 0; i < sizeof ( unsigned long long ) * 8 + offset; ++ i ) { - data.push_back ( true ); - } - - for ( unsigned i = 0; i < sizeof ( unsigned long long ) * 8; ++ i ) { - data.push_back ( ( bool ) ( shadow & ( 1ULL << i ) ) ); - } - - data >>= sizeof ( unsigned long long ) * 6 - 1; - - std::vector < bool > ref; - for ( unsigned i = 0; i < sizeof ( unsigned long long ) * 2 + offset; ++ i ) { - ref.push_back ( true ); - } - - for ( unsigned i = 0; i < sizeof ( unsigned long long ) * 8; ++ i ) { - ref.push_back ( ( bool ) ( shadow & ( 1ULL << i ) ) ); - } - - ref.resize ( 128 + offset ); - - std::cout << "data = " << data << std::endl; - std::cout << "ref = " << ref << std::endl; - - CPPUNIT_ASSERT ( data == ref );*/ -} - -void SparseBoolVectorTest::testShifts2() { -/* unsigned long long shadow = 0x2A76B147D6521C87ULL; - std::vector < bool > data; - - for ( unsigned i = 0; i < sizeof ( unsigned long long ) * 8; ++ i ) { - data.push_back ( ( bool ) ( shadow & ( 1ULL << i ) ) ); - } - - shadow >>= 10; - data >>= 10; - - std::vector < bool > ref; - for ( unsigned i = 0; i < sizeof ( unsigned long long ) * 8; ++ i ) { - ref.push_back ( ( bool ) ( shadow & ( 1ULL << i ) ) ); - } - - // std::cout << "data = " << data << std::endl; - // std::cout << "ref = " << ref << std::endl; - - CPPUNIT_ASSERT ( data == ref ); - - for ( unsigned long i = - sizeof ( unsigned long long ) / 2 ; i < sizeof ( unsigned long long ) * 8; ++ i ) - testOffset ( i ); */ -} - -void SparseBoolVectorTest::testShifts3() { -/* unsigned long long shadow = 0x2A76B147D6521C87ULL; - std::vector < bool > data; - - for ( unsigned i = 0; i < sizeof ( unsigned long long ) * 8; ++ i ) { - data.push_back ( ( bool ) ( shadow & ( 1ULL << i ) ) ); - } - for ( unsigned i = 0; i < sizeof ( unsigned long long ) * 8; ++ i ) { - data.push_back ( ( bool ) ( shadow & ( 1ULL << i ) ) ); - } - for ( unsigned i = 0; i < sizeof ( unsigned long long ) * 8; ++ i ) { - data.push_back ( ( bool ) ( shadow & ( 1ULL << i ) ) ); - } - - std::vector < bool > data2 = data; - data2 >>= 64; - - data >>= 32; - data >>= 16; - data >>= 8; - data >>= 4; - data >>= 2; - data >>= 1; - data >>= 1; - - std::cout << "data = " << data << std::endl; - std::cout << "data2 = " << data2 << std::endl; - - data2 >>= 1; - data2 >>= 2; - data2 >>= 4; - data2 >>= 8; - data2 >>= 16; - data2 >>= 32; - data2 >>= 1; - - data >>= 27; - data >>= 17; - data >>= 13; - data >>= 7; - - std::cout << "data = " << data << std::endl; - std::cout << "data2 = " << data2 << std::endl; - - CPPUNIT_ASSERT ( data2 == data );*/ -} - std::vector < bool > createTestVectorBool ( size_t size ) { unsigned long long shadow = 0x2A76B147D6521C87ULL; std::vector < bool > ref; @@ -179,10 +76,10 @@ void testOffset2 ( size_t size, size_t shift ) { data <<= shift; ref <<= shift; - std::cout << "size = " << size << std::endl; +/* std::cout << "size = " << size << std::endl; std::cout << "shift = " << shift << std::endl; std::cout << "data = " << data.data ( ) << std::endl; - std::cout << "ref = " << common::SparseBoolVector ( ref ).data ( ) << std::endl; + std::cout << "ref = " << common::SparseBoolVector ( ref ).data ( ) << std::endl;*/ CPPUNIT_ASSERT ( data == common::SparseBoolVector ( ref ) ); } @@ -229,8 +126,8 @@ void SparseBoolVectorTest::testShifts5() { data <<= 1; data <<= 1; - std::cout << "data = " << data.data ( ) << std::endl; - std::cout << "data2 = " << data2.data ( ) << std::endl; +/* std::cout << "data = " << data.data ( ) << std::endl; + std::cout << "data2 = " << data2.data ( ) << std::endl;*/ data2 <<= 1; data2 <<= 2; @@ -245,8 +142,8 @@ void SparseBoolVectorTest::testShifts5() { data <<= 13; data <<= 7; - std::cout << "data = " << data.data ( ) << std::endl; - std::cout << "data2 = " << data2.data ( ) << std::endl; +/* std::cout << "data = " << data.data ( ) << std::endl; + std::cout << "data2 = " << data2.data ( ) << std::endl;*/ CPPUNIT_ASSERT ( data2 == data ); } @@ -335,8 +232,8 @@ void SparseBoolVectorTest::testSubscript() { std::vector < bool > ref = createTestVectorBool ( 2000 ); common::SparseBoolVector data ( ref ); - std::cout << ref << std::endl; - std::cout << data.data ( ) << std::endl; +/* std::cout << ref << std::endl; + std::cout << data.data ( ) << std::endl;*/ for ( size_t i = 0; i < ref.size ( ); ++ i ) CPPUNIT_ASSERT_EQUAL_MESSAGE ( "Failed on index " + std::to_string ( i ), ( bool ) ref [ i ], ( bool ) data [ i ] ); @@ -400,14 +297,14 @@ void SparseBoolVectorTest::testXmlApi() { std::deque<sax::Token> tokens = alib::XmlDataFactory::toTokens( data ); std::string tmp; sax::SaxComposeInterface::printMemory(tmp, tokens); - std::cout << tmp << std::endl; +// std::cout << tmp << std::endl; std::deque<sax::Token> tokens2; sax::SaxParseInterface::parseMemory(tmp, tokens2); common::SparseBoolVector data2 = alib::XmlDataFactory::fromTokens ( std::move ( tokens2 ) ); - std::cout << data.data ( ) << std::endl; - std::cout << data2.data ( ) << std::endl; +/* std::cout << data.data ( ) << std::endl; + std::cout << data2.data ( ) << std::endl;*/ CPPUNIT_ASSERT( data == data2 ); } diff --git a/alib2data/test-src/common/SparseBoolVectorTest.h b/alib2data/test-src/common/SparseBoolVectorTest.h index eaa0fe3cf7..0a2347f969 100644 --- a/alib2data/test-src/common/SparseBoolVectorTest.h +++ b/alib2data/test-src/common/SparseBoolVectorTest.h @@ -7,8 +7,6 @@ class SparseBoolVectorTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( SparseBoolVectorTest ); CPPUNIT_TEST( testVectorCompatibility ); - CPPUNIT_TEST( testShifts2 ); - CPPUNIT_TEST( testShifts3 ); CPPUNIT_TEST( testShifts4 ); CPPUNIT_TEST( testShifts5 ); CPPUNIT_TEST( testOnesIterator ); @@ -24,8 +22,6 @@ public: void tearDown(); void testVectorCompatibility(); - void testShifts2(); - void testShifts3(); void testShifts4(); void testShifts5(); void testOnesIterator(); -- GitLab