LCOV - code coverage report
Current view: top level - UTests - testSimpleTest.cpp (source / functions) Hit Total Coverage
Test: Coverage example Lines: 22 24 91.7 %
Date: 2021-12-02 17:21:05 Functions: 6 6 100.0 %

          Line data    Source code
       1             : ///////////////////////////////////////////////////////////////////////////
       2             : // Spetabaru - Berenger Bramas MPCDF - 2017
       3             : // Under LGPL Licence, please you must read the LICENCE file.
       4             : ///////////////////////////////////////////////////////////////////////////
       5             : 
       6             : #include "UTester.hpp"
       7             : 
       8             : #include "Data/SpDataAccessMode.hpp"
       9             : #include "Utils/SpUtils.hpp"
      10             : 
      11             : #include "Task/SpTask.hpp"
      12             : #include "Legacy/SpRuntime.hpp"
      13             : 
      14             : class SimpleTest : public UTester< SimpleTest > {
      15             :     using Parent = UTester< SimpleTest >;
      16             : 
      17           1 :     void TestBasic(){
      18           1 :         const int NumThreads = SpUtils::DefaultNumThreads();
      19           2 :         SpRuntime runtime(NumThreads);
      20             : 
      21           1 :         const int initVal = 1;
      22           1 :         int writeVal = 0;
      23             : 
      24           0 :         runtime.task(SpRead(initVal),
      25           2 :                      [this, &initVal](const int& initValParam){
      26           1 :             UASSERTETRUE(&initValParam == &initVal);
      27           5 :         });
      28             : 
      29           1 :         runtime.task(SpRead(initVal), SpWrite(writeVal),
      30           1 :                      [](const int& initValParam, int& writeValParam){
      31           1 :             writeValParam += initValParam;
      32           2 :         });
      33             : 
      34           0 :         runtime.task(SpRead(writeVal),
      35           1 :                      [this](const int& writeValParam){
      36           1 :             UASSERTETRUE(writeValParam == initVal);
      37           2 :         });
      38             : 
      39           1 :         runtime.waitAllTasks();
      40             : 
      41           1 :         runtime.stopAllThreads();
      42           1 :     }
      43             : 
      44           1 :     void SetTests() {
      45           1 :         Parent::AddTest(&SimpleTest::TestBasic, "Basic test for vec type");
      46           1 :     }
      47             : };
      48             : 
      49             : // You must do this
      50           1 : TestClass(SimpleTest)
      51             : 
      52             : 

Generated by: LCOV version 1.14