LCOV - code coverage report
Current view: top level - test - SharedTest.h (source / functions) Hit Total Coverage
Test: coverage.info.cleaned Lines: 14 14 100.0 %
Date: 2016-06-29 12:30:40 Functions: 4 5 80.0 %

          Line data    Source code
       1             : #ifndef DASH__TEST__SHARED_TEST_H_
       2             : #define DASH__TEST__SHARED_TEST_H_
       3             : 
       4             : #include <gtest/gtest.h>
       5             : #include <libdash.h>
       6             : 
       7             : #include "TestBase.h"
       8             : 
       9             : /**
      10             :  * Test fixture for class dash::Shared
      11             :  */
      12             : class SharedTest : public ::testing::Test {
      13             : protected:
      14             :   size_t _dash_id;
      15             :   size_t _dash_size;
      16             : 
      17          12 :   SharedTest()
      18             :   : _dash_id(0),
      19          12 :     _dash_size(0)
      20             :   {
      21             :     LOG_MESSAGE(">>> Test suite: SharedTest");
      22             :     LOG_MESSAGE(">>> Hostname: %s PID: %d", _hostname().c_str(), _pid());
      23          12 :   }
      24             : 
      25          12 :   virtual ~SharedTest()
      26          12 :   {
      27             :     LOG_MESSAGE("<<< Closing test suite: SharedTest");
      28          12 :   }
      29             : 
      30          12 :   virtual void SetUp()
      31             :   {
      32          12 :     _dash_id   = dash::myid();
      33          12 :     _dash_size = dash::size();
      34          12 :     dash::barrier();
      35             :     LOG_MESSAGE("===> Running test case with %d units ...", _dash_size);
      36          12 :   }
      37             : 
      38          12 :   virtual void TearDown()
      39             :   {
      40          12 :     dash::barrier();
      41             :     LOG_MESSAGE("<=== Finished test case with %d units", _dash_size);
      42          12 :   }
      43             : 
      44             : protected:
      45             :   std::string _hostname() {
      46             :     char hostname[100];
      47             :     gethostname(hostname, 100);
      48             :     return std::string(hostname);
      49             :   }
      50             : 
      51             :   int _pid() {
      52             :     return static_cast<int>(getpid());
      53             :   }
      54             : };
      55             : 
      56             : #endif // DASH__TEST__SHARED_TEST_H_

Generated by: LCOV version 1.12