LCOV - code coverage report
Current view: top level - UTests - testSimpleTestNoSpec.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 "TaskGraph/SpTaskGraph.hpp"
      13             : #include "Compute/SpComputeEngine.hpp"
      14             : #include "Compute/SpWorker.hpp"
      15             : 
      16             : class SimpleTestNoSpec : public UTester< SimpleTestNoSpec > {
      17             :     using Parent = UTester< SimpleTestNoSpec >;
      18             : 
      19           1 :     void TestBasic(){
      20           2 :         SpComputeEngine ce(SpWorker::createDefaultWorkerTeam());
      21           2 :         SpTaskGraph<SpSpeculativeModel::SP_NO_SPEC> tg;
      22             :         
      23           1 :         tg.computeOn(ce);
      24             : 
      25           1 :         const int initVal = 1;
      26           1 :         int writeVal = 0;
      27             : 
      28           0 :         tg.task(SpRead(initVal),
      29           2 :                      [this, &initVal](const int& initValParam){
      30           1 :             UASSERTETRUE(&initValParam == &initVal);
      31           5 :         });
      32             : 
      33           1 :         tg.task(SpRead(initVal), SpWrite(writeVal),
      34           1 :                      [](const int& initValParam, int& writeValParam){
      35           1 :             writeValParam += initValParam;
      36           2 :         });
      37             : 
      38           0 :         tg.task(SpRead(writeVal),
      39           1 :                      [this](const int& writeValParam){
      40           1 :             UASSERTETRUE(writeValParam == initVal);
      41           2 :         });
      42             : 
      43           1 :         tg.waitAllTasks();
      44           1 :     }
      45             : 
      46           1 :     void SetTests() {
      47           1 :         Parent::AddTest(&SimpleTestNoSpec::TestBasic, "Basic test for non speculative task graphs");
      48           1 :     }
      49             : };
      50             : 
      51             : // You must do this
      52           1 : TestClass(SimpleTestNoSpec)
      53             : 
      54             : 

Generated by: LCOV version 1.14