LCOV - code coverage report
Current view: top level - UTests - testMerge.cpp (source / functions) Hit Total Coverage
Test: Coverage example Lines: 26 27 96.3 %
Date: 2021-12-02 17:21:05 Functions: 8 8 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             : #include "utestUtils.hpp"
       8             : 
       9             : #include "Data/SpDataAccessMode.hpp"
      10             : #include "Utils/SpUtils.hpp"
      11             : #include "Utils/SpArrayView.hpp"
      12             : #include "Utils/SpArrayAccessor.hpp"
      13             : 
      14             : #include "Task/SpTask.hpp"
      15             : #include "Legacy/SpRuntime.hpp"
      16             : 
      17             : class TestMerge : public UTester< TestMerge > {
      18             :     using Parent = UTester< TestMerge >;
      19             :     
      20             :     template <SpSpeculativeModel Spm>
      21           3 :     void Test(){
      22           6 :         SpRuntime<Spm> runtime;
      23             : 
      24           3 :         runtime.setSpeculationTest([](const int /*inNbReadyTasks*/, const SpProbability& /*inProbability*/) -> bool{
      25           0 :             return true;
      26             :         });
      27             :         
      28           3 :         int a=0, b=0;
      29             : 
      30           3 :         std::promise<bool> promise1;
      31             : 
      32          18 :         runtime.task(SpPotentialWrite(a), [&promise1]([[maybe_unused]] int& param_a){
      33           3 :             promise1.get_future().get();
      34           3 :             return false;
      35             :         });
      36             :         
      37           6 :         runtime.task(SpPotentialWrite(b), []([[maybe_unused]] int& param_b){
      38           3 :             return false;
      39             :         });
      40             :         
      41           8 :         runtime.task(SpPotentialWrite(a), SpPotentialWrite(b), []([[maybe_unused]] int& param_a, [[maybe_unused]] int& param_b){
      42           5 :             return false;
      43             :         });
      44             :         
      45           3 :         promise1.set_value(true);
      46             :         
      47           3 :         runtime.waitAllTasks();
      48           3 :         runtime.stopAllThreads();
      49             : 
      50           3 :         runtime.generateDot("/tmp/testMerge" + std::to_string(static_cast<int>(Spm)) + ".dot", true);
      51           3 :     }
      52             :     
      53           1 :     void Test1() { Test<SpSpeculativeModel::SP_MODEL_1>(); }
      54           1 :     void Test2() { Test<SpSpeculativeModel::SP_MODEL_2>(); }
      55           1 :     void Test3() { Test<SpSpeculativeModel::SP_MODEL_3>(); }
      56             : 
      57           1 :     void SetTests() {
      58           1 :         Parent::AddTest(&TestMerge::Test1, "Basic merge test for model 1");
      59           1 :         Parent::AddTest(&TestMerge::Test2, "Basic merge test for model 2");
      60           1 :         Parent::AddTest(&TestMerge::Test3, "Basic merge test for model 3");
      61           1 :     }
      62             : };
      63             : 
      64             : // You must do this
      65           1 : TestClass(TestMerge)
      66             : 
      67             : 

Generated by: LCOV version 1.14