C++ YASMIN (Yet Another State MachINe)
Loading...
Searching...
No Matches
test_concurrence.cpp File Reference
#include <gtest/gtest.h>
#include <chrono>
#include <condition_variable>
#include <future>
#include <iostream>
#include <memory>
#include <string>
#include <thread>
#include "yasmin/blackboard.hpp"
#include "yasmin/concurrence.hpp"
#include "yasmin/state.hpp"
#include "yasmin/state_machine.hpp"
#include "yasmin/types.hpp"
Include dependency graph for test_concurrence.cpp:

Classes

class  FooState
 Represents the "Foo" state in the state machine. More...
class  BarState
 Represents the "Bar" state in the state machine. More...
class  TestConcurrence
class  ConfigurableConcurrentState
struct  ConcurrentWriteSync
class  BlockingWriteState
 State that waits until both concurrent branches are ready and then writes a value through the remapped blackboard key. More...
class  DelayedStartStateMachine
 Small helper state machine that delays its start. More...

Functions

 TEST_F (TestConcurrence, TestCall)
 TEST_F (TestConcurrence, TestCancel)
 TEST_F (TestConcurrence, TestStr)
int main (int argc, char **argv)
 TEST_F (TestConcurrence, TestConfigureAppliesParameterMappingsAndRunsOnce)
 TEST_F (TestConcurrence, TestConcurrentNestedStateMachinesKeepRemappingsIsolatedPerBranch)
 Verify that concurrent nested state machines keep remappings isolated.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

◆ TEST_F() [1/5]

TEST_F ( TestConcurrence ,
TestCall  )

◆ TEST_F() [2/5]

TEST_F ( TestConcurrence ,
TestCancel  )

◆ TEST_F() [3/5]

TEST_F ( TestConcurrence ,
TestConcurrentNestedStateMachinesKeepRemappingsIsolatedPerBranch  )

Verify that concurrent nested state machines keep remappings isolated.

Each branch has its own nested remapping chain: Branch A: foo_str -> foo_inner_a -> foo_branch_a Branch B: foo_str -> foo_inner_b -> foo_branch_b

Both branches run at the same time and write through "foo_str". If remapping state is still shared globally, one branch can overwrite the remapping context of the other and the values may end up under the wrong keys.

The expected behavior is:

  • each final branch key gets its own value
  • no intermediate remapping keys remain visible
  • the original key "foo_str" is not stored directly

◆ TEST_F() [4/5]

TEST_F ( TestConcurrence ,
TestConfigureAppliesParameterMappingsAndRunsOnce  )

◆ TEST_F() [5/5]

TEST_F ( TestConcurrence ,
TestStr  )