diff --git a/src/TNL/Functions/MeshFunction.h b/src/TNL/Functions/MeshFunction.h
index b0a44c27f5303f8b47742301b29ed209c4b71557..3eb99fc871016beb5cd6d9fa0d2169c3491565e8 100644
--- a/src/TNL/Functions/MeshFunction.h
+++ b/src/TNL/Functions/MeshFunction.h
@@ -184,6 +184,11 @@ class MeshFunction :
    
 };
 
+template< typename Mesh,
+          int MeshEntityDimension,
+          typename Real >
+std::ostream& operator << ( std::ostream& str, const MeshFunction< Mesh, MeshEntityDimension, Real >& f );
+
 } // namespace Functions
 } // namespace TNL
 
diff --git a/src/TNL/Functions/MeshFunction_impl.h b/src/TNL/Functions/MeshFunction_impl.h
index 872751f8ea86350b4fc775aed133fabd133de7e8..9a7867b5e45d2c983dc85f01cf6928afa6b3afd2 100644
--- a/src/TNL/Functions/MeshFunction_impl.h
+++ b/src/TNL/Functions/MeshFunction_impl.h
@@ -571,7 +571,17 @@ setupSynchronizer( DistributedMeshType *distributedMesh )
       this->synchronizer.setDistributedGrid( distributedMesh );
 }
 
- 
+template< typename Mesh,
+          int MeshEntityDimension,
+          typename Real >
+std::ostream&
+operator << ( std::ostream& str, const MeshFunction< Mesh, MeshEntityDimension, Real >& f )
+{
+   str << f.getData();
+   return str;
+}
+
+
 } // namespace Functions
 } // namespace TNL
 
diff --git a/src/UnitTests/Functions/CMakeLists.txt b/src/UnitTests/Functions/CMakeLists.txt
index 9641a5b329ea3069f4edc6e0c0664eedb4aa94e2..cf9466de4525130a3ba2c6c0f9dd3c3bd988af8c 100644
--- a/src/UnitTests/Functions/CMakeLists.txt
+++ b/src/UnitTests/Functions/CMakeLists.txt
@@ -1,13 +1,20 @@
 IF( BUILD_CUDA )
+   CUDA_ADD_EXECUTABLE( MeshFunctionTest MeshFunctionTest.h MeshFunctionTest.cu OPTIONS ${CXX_TESTS_FLAGS} )
+   TARGET_COMPILE_OPTIONS( MeshFunctionTest PRIVATE ${CXX_TESTS_FLAGS} )
+   TARGET_LINK_LIBRARIES( MeshFunctionTest ${GTEST_BOTH_LIBRARIES} tnl )
+
    CUDA_ADD_EXECUTABLE( BoundaryMeshFunctionTest BoundaryMeshFunctionTest.h BoundaryMeshFunctionTest.cu OPTIONS ${CXX_TESTS_FLAGS} )
-   TARGET_LINK_LIBRARIES( BoundaryMeshFunctionTest ${GTEST_BOTH_LIBRARIES}
-                                                           tnl )
+   TARGET_COMPILE_OPTIONS( BoundaryMeshFunctionTest PRIVATE ${CXX_TESTS_FLAGS} )
+   TARGET_LINK_LIBRARIES( BoundaryMeshFunctionTest ${GTEST_BOTH_LIBRARIES} tnl )
 ELSE(  BUILD_CUDA )
+   ADD_EXECUTABLE( MeshFunctionTest MeshFunctionTest.h MeshFunctionTest.cpp )
+   TARGET_COMPILE_OPTIONS( MeshFunctionTest PRIVATE ${CXX_TESTS_FLAGS} )
+   TARGET_LINK_LIBRARIES( MeshFunctionTest ${GTEST_BOTH_LIBRARIES} tnl )
+
    ADD_EXECUTABLE( BoundaryMeshFunctionTest BoundaryMeshFunctionTest.h BoundaryMeshFunctionTest.cpp )
    TARGET_COMPILE_OPTIONS( BoundaryMeshFunctionTest PRIVATE ${CXX_TESTS_FLAGS} )
-   TARGET_LINK_LIBRARIES( BoundaryMeshFunctionTest ${GTEST_BOTH_LIBRARIES}
-                                                           tnl )
+   TARGET_LINK_LIBRARIES( BoundaryMeshFunctionTest ${GTEST_BOTH_LIBRARIES} tnl )
 ENDIF( BUILD_CUDA )
 
-
+ADD_TEST( MeshFunctionTest ${EXECUTABLE_OUTPUT_PATH}/MeshFunctionTest${CMAKE_EXECUTABLE_SUFFIX} )
 ADD_TEST( BoundaryMeshFunctionTest ${EXECUTABLE_OUTPUT_PATH}/BoundaryMeshFunctionTest${CMAKE_EXECUTABLE_SUFFIX} )
\ No newline at end of file
diff --git a/src/UnitTests/Functions/MeshFunctionTest.cpp b/src/UnitTests/Functions/MeshFunctionTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..85943c29fe36235a6a3dd57b9bd1fdbe133e7b69
--- /dev/null
+++ b/src/UnitTests/Functions/MeshFunctionTest.cpp
@@ -0,0 +1,11 @@
+/***************************************************************************
+                          MeshFunctionTest.cpp  -  description
+                             -------------------
+    begin                : Sep 11, 2018
+    copyright            : (C) 2018 by oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#include "MeshFunctionTest.h"
diff --git a/src/UnitTests/Functions/MeshFunctionTest.cu b/src/UnitTests/Functions/MeshFunctionTest.cu
new file mode 100644
index 0000000000000000000000000000000000000000..9f8affcd9ce70c9d94a5cde4a0ef7a008c90e412
--- /dev/null
+++ b/src/UnitTests/Functions/MeshFunctionTest.cu
@@ -0,0 +1,11 @@
+/***************************************************************************
+                          MeshFunctionTest.cu  -  description
+                             -------------------
+    begin                : Sep 11, 2018
+    copyright            : (C) 2018 by oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#include "MeshFunctionTest.h"
diff --git a/src/UnitTests/Functions/MeshFunctionTest.h b/src/UnitTests/Functions/MeshFunctionTest.h
new file mode 100644
index 0000000000000000000000000000000000000000..b60daf091a291579f3c4e50318805ed2dc699163
--- /dev/null
+++ b/src/UnitTests/Functions/MeshFunctionTest.h
@@ -0,0 +1,57 @@
+/***************************************************************************
+                          MeshFunctionTest.h  -  description
+                             -------------------
+    begin                : Sep 11, 2018
+    copyright            : (C) 2018 by oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
+
+#include "../GtestMissingError.h"
+
+#ifdef HAVE_GTEST 
+#include <gtest/gtest.h>
+#include <sstream>
+#include <TNL/Functions/MeshFunction.h>
+#include <TNL/Meshes/Grid.h>
+#include <TNL/Pointers/SharedPointer.h>
+
+TEST( MeshFunctionTest, BasicConstructor )
+{
+   using Grid = TNL::Meshes::Grid< 2 >;
+   TNL::Functions::MeshFunction< Grid > meshFunction;
+}
+
+TEST( MeshFunctionTest, OstreamOperatorTest )
+{
+   using GridType = TNL::Meshes::Grid< 2 >;
+   using GridPointer = TNL::Pointers::SharedPointer< GridType >;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using MeshFunctionType = TNL::Functions::MeshFunction< GridType >;
+   GridPointer grid;
+   grid->setDimensions( CoordinatesType( 3, 3 ) );
+   MeshFunctionType meshFunction( grid );
+   meshFunction.getData().setValue( 1.0 );
+   
+   const char* str = "[ 1, 1, 1, 1, 1, 1, 1, 1, 1 ]";
+   std::stringstream string_stream1, string_stream2( str );
+   string_stream1 << meshFunction;
+   EXPECT_EQ( string_stream1.str(), string_stream2.str() );
+}
+
+
+#endif
+
+
+int main( int argc, char* argv[] )
+{
+#ifdef HAVE_GTEST
+   ::testing::InitGoogleTest( &argc, argv );
+   return RUN_ALL_TESTS();
+#else
+   throw GtestMissingError();
+#endif
+}