Skip to content
Snippets Groups Projects
Commit dcb58e82 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber Committed by Jakub Klinkovský
Browse files

Fixes ListTest and adde comment ti templated String constructor.

parent c615ee12
No related branches found
No related tags found
1 merge request!10Periodic BC in distributed grid
...@@ -52,7 +52,11 @@ public: ...@@ -52,7 +52,11 @@ public:
//! Copy constructor //! Copy constructor
String( const String& str ); String( const String& str );
//! Convert anything to a string //////
/// Templated constructor
///
/// It must be explicit otherwise it is called recursively from inside of its
/// definition ( in operator << ). It leads to stack overflow and segmentation fault.
template< typename T > template< typename T >
explicit explicit
String( T value ) String( T value )
......
...@@ -63,10 +63,10 @@ TYPED_TEST( ListTest, operations ) ...@@ -63,10 +63,10 @@ TYPED_TEST( ListTest, operations )
ListType a, b; ListType a, b;
a.Append( 0 ); a.Append( (ValueType) 0 );
a.Append( 1 ); a.Append( (ValueType) 1 );
a.Prepend( 2 ); a.Prepend( (ValueType) 2 );
a.Insert( 3, 1 ); a.Insert( (ValueType) 3, 1 );
EXPECT_EQ( a.getSize(), 4 ); EXPECT_EQ( a.getSize(), 4 );
EXPECT_EQ( a[ 0 ], (ValueType) 2 ); EXPECT_EQ( a[ 0 ], (ValueType) 2 );
EXPECT_EQ( a[ 1 ], (ValueType) 3 ); EXPECT_EQ( a[ 1 ], (ValueType) 3 );
...@@ -77,7 +77,7 @@ TYPED_TEST( ListTest, operations ) ...@@ -77,7 +77,7 @@ TYPED_TEST( ListTest, operations )
EXPECT_EQ( b.getSize(), 4 ); EXPECT_EQ( b.getSize(), 4 );
EXPECT_EQ( a, b ); EXPECT_EQ( a, b );
b.Insert( 4, 4 ); b.Insert( ( ValueType ) 4, 4 );
EXPECT_NE( a, b ); EXPECT_NE( a, b );
EXPECT_EQ( b[ 4 ], (ValueType) 4 ); EXPECT_EQ( b[ 4 ], (ValueType) 4 );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment