Commit 71296023 authored by Ing. Jan Trávníček's avatar Ing. Jan Trávníček

std: use static cast instead of c casts in tests

parent a9223130
......@@ -49,7 +49,7 @@ TEST_CASE ( "Algorithm Test", "[unit][std][bits]" ) {
/* std::function<long(const int&)> lamb = [](const int& elem) { return (long) elem + 1; };
ext::set<long> out = ext::transform<long>(in, lamb); //*/
ext::set<long> out = ext::transform<long>(in, [](const int& elem) { return (long) elem + 1; });
ext::set<long> out = ext::transform<long>(in, [](const int& elem) { return static_cast < long > ( elem + 1 ); });
CHECK(ref == out);
}
......
......@@ -158,7 +158,7 @@ TEST_CASE ( "Variant", "[unit][std][container]" ) {
CHECK( (e == d) == true );
CHECK ( ( ( std::string ) e ) == "43" );
CHECK ( ( static_cast < std::string > ( e ) ) == "43" );
std::stringstream ss;
ss << e;
......@@ -232,14 +232,14 @@ TEST_CASE ( "Variant", "[unit][std][container]" ) {
v1.set ( 'a' );
CHECK ( v1.get < char > ( ) == 'a' );
v1.set ( (int) 'a' );
v1.set ( static_cast < int > ( 'a' ) );
CHECK ( v1.is < int > ( ) );
std::cout << v1 << std::endl;
}
SECTION ( "size_t" ) {
ext::variant < size_t, int > a ( ( size_t ) 1 );
ext::variant < size_t, int > a ( static_cast < size_t > ( 1 ) );
ext::variant < size_t, int > b ( 1 );
CHECK ( a.is < size_t > ( ) );
......
......@@ -194,8 +194,8 @@ TEST_CASE ( "Vector", "[unit][std][container]" ) {
CHECK ( data == ref );
for ( long i = - ( long ) sizeof ( unsigned long long ) / 2 ; i < ( long ) sizeof ( unsigned long long ) * 8; ++ i )
for ( long j = - ( long ) sizeof ( unsigned long long ) / 2 ; j < ( long ) sizeof ( unsigned long long ) * 8; ++ j )
for ( long i = - static_cast < long > ( sizeof ( unsigned long long ) ) / 2 ; i < static_cast < long > ( sizeof ( unsigned long long ) ) * 8; ++ i )
for ( long j = - static_cast < long > ( sizeof ( unsigned long long ) ) / 2 ; j < static_cast < long > ( sizeof ( unsigned long long ) ) * 8; ++ j )
testOffset ( i, j );
}
......@@ -305,8 +305,8 @@ TEST_CASE ( "Vector", "[unit][std][container]" ) {
CHECK ( data == ref );
for ( long i = - ( long ) sizeof ( unsigned long long ) / 2 ; i < ( long ) sizeof ( unsigned long long ) * 8; ++ i )
for ( long j = - ( long ) sizeof ( unsigned long long ) / 2 ; j < ( long ) sizeof ( unsigned long long ) * 8; ++ j )
for ( long i = - static_cast < long > ( sizeof ( unsigned long long ) ) / 2 ; i < static_cast < long > ( sizeof ( unsigned long long ) ) * 8; ++ i )
for ( long j = - static_cast < long > ( sizeof ( unsigned long long ) ) / 2 ; j < static_cast < long > ( sizeof ( unsigned long long ) ) * 8; ++ j )
testOffset ( i, j );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment