mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-16 00:46:03 +08:00
Merge branch 'feature/reduce-size-of-state_chart' into development
This commit is contained in:
commit
9dafa0bb70
@ -17,31 +17,31 @@ print('')
|
||||
|
||||
# Get the current path of the script
|
||||
arduino_dir = os.path.dirname(__file__)
|
||||
print('arduino_dir = ', arduino_dir)
|
||||
print('arduino_dir = ', arduino_dir)
|
||||
|
||||
# Get the root folder of the ETL
|
||||
etl_dir = os.path.dirname(arduino_dir)
|
||||
print('etl_dir = ', etl_dir)
|
||||
print('etl_dir = ', etl_dir)
|
||||
|
||||
# Get the ETL repository folder
|
||||
include_dir = os.path.join(etl_dir, 'include')
|
||||
print('include_dir = ', include_dir)
|
||||
print('include_dir = ', include_dir)
|
||||
|
||||
# Get the ETL arduino_examples folder
|
||||
arduino_examples_dir = os.path.join(arduino_dir, 'examples')
|
||||
print('examples_dir = ', arduino_examples_dir)
|
||||
print('examples_dir = ', arduino_examples_dir)
|
||||
|
||||
# Get the root folder of both repositories
|
||||
common_dir = os.path.dirname(etl_dir)
|
||||
print('common_dir = ', common_dir)
|
||||
print('common_dir = ', common_dir)
|
||||
|
||||
# Get the ETL Arduino repository folder
|
||||
etl_arduino_dir = os.path.join(common_dir, 'etl-arduino')
|
||||
print('etl_arduino_dir = ', etl_arduino_dir)
|
||||
print('etl_arduino_dir = ', etl_arduino_dir)
|
||||
|
||||
# Get the ETL Arduino src repository folder
|
||||
etl_arduino_src_dir = os.path.join(etl_arduino_dir, 'src')
|
||||
print('etl_arduino_src_dir = ', etl_arduino_src_dir)
|
||||
print('etl_arduino_src_dir = ', etl_arduino_src_dir)
|
||||
|
||||
# Get the ETL Arduino examples repository folder
|
||||
etl_arduino_examples_dir = os.path.join(etl_arduino_dir, 'examples')
|
||||
@ -51,7 +51,7 @@ print('')
|
||||
|
||||
# Copy the library properties
|
||||
filename = 'library.properties'
|
||||
source = os.path.join(etl_dir, filename)
|
||||
source = os.path.join(arduino_dir, filename)
|
||||
destination = os.path.join(etl_arduino_dir, filename)
|
||||
print('Copy the library properties')
|
||||
print(' From :', source)
|
||||
@ -60,6 +60,17 @@ shutil.copyfile(source, destination)
|
||||
|
||||
print('')
|
||||
|
||||
# Copy the library json
|
||||
filename = 'library.json'
|
||||
source = os.path.join(arduino_dir, filename)
|
||||
destination = os.path.join(etl_arduino_dir, filename)
|
||||
print('Copy the library json')
|
||||
print(' From :', source)
|
||||
print(' To :', destination)
|
||||
shutil.copyfile(source, destination)
|
||||
|
||||
print('')
|
||||
|
||||
# Copy the Arduino ETL header
|
||||
filename = 'Embedded_Template_Library.h'
|
||||
source = os.path.join(arduino_dir, filename)
|
||||
|
||||
21
arduino/library.json
Normal file
21
arduino/library.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "Embedded Template Library - Arduino",
|
||||
"version": "20.23.0",
|
||||
"authors": {
|
||||
"name": "John Wellbelove",
|
||||
"email": "john.wellbelove@etlcpp.com"
|
||||
},
|
||||
"homepage": "https://www.etlcpp.com/",
|
||||
"license": "MIT",
|
||||
"description": "ETL. A C++ template library tailored for embedded systems. Directories formated for Arduino",
|
||||
"keywords": "c-plus-plus, cpp, algorithms, containers, templates",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ETLCPP/etl.git"
|
||||
},
|
||||
"build": {
|
||||
"includeDir": "include"
|
||||
},
|
||||
"platforms": "*",
|
||||
"frameworks": "*"
|
||||
}
|
||||
10
arduino/library.properties
Normal file
10
arduino/library.properties
Normal file
@ -0,0 +1,10 @@
|
||||
name=Embedded Template Library - Arduino
|
||||
version=20.23.0
|
||||
author= John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
license=MIT
|
||||
sentence=ETL. A C++ template library tailored for embedded systems.
|
||||
paragraph=
|
||||
category=Other
|
||||
url=https://www.etlcpp.com/
|
||||
architectures=*
|
||||
@ -195,8 +195,6 @@ namespace etl
|
||||
typename etl::enable_if<etl::is_unsigned<T>::value, T>::type
|
||||
rotl(T value, int n) ETL_NOEXCEPT
|
||||
{
|
||||
ETL_CONSTANT size_t N = etl::integral_limits<T>::bits;
|
||||
|
||||
if (n < 0)
|
||||
{
|
||||
return etl::rotate_right(value, -n);
|
||||
@ -215,8 +213,6 @@ namespace etl
|
||||
typename etl::enable_if<etl::is_unsigned<T>::value, T>::type
|
||||
rotr(T value, int n) ETL_NOEXCEPT
|
||||
{
|
||||
ETL_CONSTANT size_t N = etl::integral_limits<T>::bits;
|
||||
|
||||
if (n < 0)
|
||||
{
|
||||
return etl::rotate_left(value, -n);
|
||||
|
||||
@ -168,8 +168,6 @@ namespace etl
|
||||
// We have something to do?
|
||||
bool has_active = !active_list.empty();
|
||||
|
||||
timer_data* ptimer = &active_list.front();
|
||||
|
||||
if (has_active)
|
||||
{
|
||||
while (has_active && (count >= active_list.front().delta))
|
||||
|
||||
@ -164,9 +164,7 @@ namespace etl
|
||||
if (try_lock())
|
||||
{
|
||||
// We have something to do?
|
||||
bool has_active = !active_list.empty();
|
||||
|
||||
timer_data* ptimer = &active_list.front();
|
||||
bool has_active = !active_list.empty();
|
||||
|
||||
if (has_active)
|
||||
{
|
||||
@ -177,7 +175,6 @@ namespace etl
|
||||
count -= timer.delta;
|
||||
|
||||
active_list.remove(timer.id, true);
|
||||
ptimer = &active_list.front();
|
||||
|
||||
if (timer.repeating)
|
||||
{
|
||||
|
||||
@ -75,7 +75,11 @@ SOFTWARE.
|
||||
#endif
|
||||
|
||||
// If true, then the endianness of the platform can be constexpr.
|
||||
#define ETL_ENDIANNESS_IS_CONSTEXPR (ETL_CPP11_SUPPORTED && defined(ETL_ENDIAN_NATIVE))
|
||||
#if (ETL_CPP11_SUPPORTED && defined(ETL_ENDIAN_NATIVE))
|
||||
#define ETL_ENDIANNESS_IS_CONSTEXPR 1
|
||||
#else
|
||||
#define ETL_ENDIANNESS_IS_CONSTEXPR 0
|
||||
#endif
|
||||
|
||||
namespace etl
|
||||
{
|
||||
|
||||
@ -177,9 +177,8 @@ namespace etl
|
||||
ETL_CONSTEXPR T midpoint(T a, T b, typename etl::enable_if<(!etl::is_pointer<T>::value &&
|
||||
!etl::is_integral<T>::value &&
|
||||
!etl::is_floating_point<T>::value &&
|
||||
etl::is_same<typename etl::iterator_traits<T>::iterator_category, ETL_OR_STD::forward_iterator_tag>::value ||
|
||||
etl::is_same<typename etl::iterator_traits<T>::iterator_category, ETL_OR_STD::bidirectional_iterator_tag>::value)
|
||||
, int>::type = 0)
|
||||
(etl::is_same<typename etl::iterator_traits<T>::iterator_category, ETL_OR_STD::forward_iterator_tag>::value ||
|
||||
etl::is_same<typename etl::iterator_traits<T>::iterator_category, ETL_OR_STD::bidirectional_iterator_tag>::value)), int>::type = 0)
|
||||
{
|
||||
etl::advance(a, etl::distance(a, b) / 2U);
|
||||
return a;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
name=Embedded Template Library ETL
|
||||
name=Embedded Template Library
|
||||
version=20.23.0
|
||||
author= John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
|
||||
@ -1,15 +1,21 @@
|
||||
===============================================================================
|
||||
20.23.0
|
||||
Recoded state_chart to reduce its resource requirements.
|
||||
Added compile time state chart variants.
|
||||
Added etl::unaligned_type for fundamental types.
|
||||
Added reverse engineered functionality from C++20 <bit>.
|
||||
Added all permutations of leading/trailing bit tests.
|
||||
Changed inline functions to templates in binary.h.
|
||||
Added etl::midpoint and etl::lerp
|
||||
Recoded etl::endian & etl::endianness to allow constexpr in certain configurations.
|
||||
Updates and fixes to etl::bitset. Added to_ulong, to_ullong, to_string member functions.
|
||||
Moved void_t definition.
|
||||
Renamed 8bit check macro.
|
||||
Updated tests to support C++20 STL.
|
||||
Modified C++ language level detection.
|
||||
Added all permutations of leading/trailing bit tests.
|
||||
etl::iterator is more SFINAE compatible.
|
||||
Updated C++ standard detection.
|
||||
|
||||
===============================================================================
|
||||
20.22.0
|
||||
|
||||
@ -224,6 +224,8 @@ set(TEST_SOURCE_FILES
|
||||
test_state_chart.cpp
|
||||
test_state_chart_with_data_parameter.cpp
|
||||
test_state_chart_with_rvalue_data_parameter.cpp
|
||||
test_state_chart_compile_time.cpp
|
||||
test_state_chart_compile_time_with_data_parameter.cpp
|
||||
test_string_char.cpp
|
||||
test_string_char_external_buffer.cpp
|
||||
test_string_stream.cpp
|
||||
@ -255,7 +257,7 @@ set(TEST_SOURCE_FILES
|
||||
test_type_lookup.cpp
|
||||
test_type_select.cpp
|
||||
test_type_traits.cpp
|
||||
# test_unaligned_type.cpp
|
||||
test_unaligned_type.cpp
|
||||
test_unordered_map.cpp
|
||||
test_unordered_multimap.cpp
|
||||
test_unordered_multiset.cpp
|
||||
|
||||
@ -73,12 +73,6 @@ SOFTWARE.
|
||||
#define ETL_POLYMORPHIC_VECTOR
|
||||
#define ETL_POLYMORPHIC_INDIRECT_VECTOR
|
||||
|
||||
#if defined(ETL_CPP20_ENABLED)
|
||||
#define ETL_CPP20_SUPPORTED 1
|
||||
#else
|
||||
#define ETL_CPP20_SUPPORTED 0
|
||||
#endif
|
||||
|
||||
//#define ETL_POLYMORPHIC_CONTAINERS
|
||||
|
||||
//#define ETL_MESSAGES_ARE_VIRTUAL
|
||||
|
||||
@ -51,7 +51,7 @@ namespace
|
||||
ABORT
|
||||
};
|
||||
|
||||
ETL_DECLARE_ENUM_TYPE(EventId, etl::istate_chart::event_id_t)
|
||||
ETL_DECLARE_ENUM_TYPE(EventId, etl::state_chart_traits::event_id_t)
|
||||
ETL_ENUM_TYPE(START, "Start")
|
||||
ETL_ENUM_TYPE(STOP, "Stop")
|
||||
ETL_ENUM_TYPE(EMERGENCY_STOP, "Emergency Stop")
|
||||
@ -73,7 +73,7 @@ namespace
|
||||
NUMBER_OF_STATES
|
||||
};
|
||||
|
||||
ETL_DECLARE_ENUM_TYPE(StateId, etl::istate_chart::state_id_t)
|
||||
ETL_DECLARE_ENUM_TYPE(StateId, etl::state_chart_traits::state_id_t)
|
||||
ETL_ENUM_TYPE(IDLE, "Idle")
|
||||
ETL_ENUM_TYPE(RUNNING, "Running")
|
||||
ETL_ENUM_TYPE(WINDING_DOWN, "Winding Down")
|
||||
@ -88,9 +88,8 @@ namespace
|
||||
public:
|
||||
|
||||
MotorControl()
|
||||
: state_chart<MotorControl>(*this, transitionTable.begin(), transitionTable.end(), StateId::IDLE)
|
||||
: etl::state_chart<MotorControl>(*this, transitionTable.begin(), transitionTable.end(), stateTable.begin(), stateTable.end(), StateId::IDLE)
|
||||
{
|
||||
this->set_state_table(stateTable.begin(), stateTable.end());
|
||||
ClearStatistics();
|
||||
}
|
||||
|
||||
@ -398,6 +397,143 @@ namespace
|
||||
CHECK_EQUAL(1, motorControl.null);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
//TEST(test_state_chart_with_delegate)
|
||||
//{
|
||||
// motorControl.ClearStatistics();
|
||||
|
||||
// auto process_event = motorControl.get_process_event_delegate();
|
||||
|
||||
// // Start the state chart
|
||||
// motorControl.guard = true;
|
||||
// motorControl.start();
|
||||
|
||||
// // Send unhandled events.
|
||||
// process_event(EventId::STOP);
|
||||
// process_event(EventId::STOPPED);
|
||||
|
||||
// CHECK_EQUAL(StateId::IDLE, int(motorControl.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(0, motorControl.speed);
|
||||
// CHECK_EQUAL(0, motorControl.startCount);
|
||||
// CHECK_EQUAL(0, motorControl.stopCount);
|
||||
// CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(0, motorControl.windingDown);
|
||||
|
||||
// // Send Start event.
|
||||
// motorControl.guard = false;
|
||||
// process_event(EventId::START);
|
||||
|
||||
// // Still in Idle state.
|
||||
|
||||
// CHECK_EQUAL(StateId::IDLE, int(motorControl.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(0, motorControl.speed);
|
||||
// CHECK_EQUAL(0, motorControl.startCount);
|
||||
// CHECK_EQUAL(0, motorControl.stopCount);
|
||||
// CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(0, motorControl.windingDown);
|
||||
// CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// // Send Start event.
|
||||
// motorControl.guard = true;
|
||||
// process_event(EventId::START);
|
||||
|
||||
// // Now in Running state.
|
||||
|
||||
// CHECK_EQUAL(StateId::RUNNING, int(motorControl.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(0, motorControl.speed);
|
||||
// CHECK_EQUAL(1, motorControl.startCount);
|
||||
// CHECK_EQUAL(0, motorControl.stopCount);
|
||||
// CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(0, motorControl.windingDown);
|
||||
// CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// // Send unhandled events.
|
||||
// process_event(EventId::START);
|
||||
// process_event(EventId::STOPPED);
|
||||
|
||||
// CHECK_EQUAL(StateId::RUNNING, int(motorControl.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(0, motorControl.speed);
|
||||
// CHECK_EQUAL(1, motorControl.startCount);
|
||||
// CHECK_EQUAL(0, motorControl.stopCount);
|
||||
// CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(0, motorControl.windingDown);
|
||||
// CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// // Send SetSpeed event.
|
||||
// process_event(EventId::SET_SPEED);
|
||||
|
||||
// // Still in Running state.
|
||||
|
||||
// CHECK_EQUAL(StateId::RUNNING, int(motorControl.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(1, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(100, motorControl.speed);
|
||||
// CHECK_EQUAL(1, motorControl.startCount);
|
||||
// CHECK_EQUAL(0, motorControl.stopCount);
|
||||
// CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(0, motorControl.windingDown);
|
||||
// CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// // Send Stop event.
|
||||
// process_event(EventId::STOP);
|
||||
|
||||
// // Now in WindingDown state.
|
||||
|
||||
// CHECK_EQUAL(StateId::WINDING_DOWN, int(motorControl.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(1, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(100, motorControl.speed);
|
||||
// CHECK_EQUAL(1, motorControl.startCount);
|
||||
// CHECK_EQUAL(1, motorControl.stopCount);
|
||||
// CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(1, motorControl.windingDown);
|
||||
// CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// // Send unhandled events.
|
||||
// process_event(EventId::START);
|
||||
// process_event(EventId::STOP);
|
||||
|
||||
// CHECK_EQUAL(StateId::WINDING_DOWN, int(motorControl.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(1, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(100, motorControl.speed);
|
||||
// CHECK_EQUAL(1, motorControl.startCount);
|
||||
// CHECK_EQUAL(1, motorControl.stopCount);
|
||||
// CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(1, motorControl.windingDown);
|
||||
// CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// // Send Stopped event.
|
||||
// process_event(EventId::STOPPED);
|
||||
|
||||
// // Now in Idle state.
|
||||
// CHECK_EQUAL(StateId::IDLE, int(motorControl.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(1, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(100, motorControl.speed);
|
||||
// CHECK_EQUAL(1, motorControl.startCount);
|
||||
// CHECK_EQUAL(1, motorControl.stopCount);
|
||||
// CHECK_EQUAL(1, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(0, motorControl.windingDown);
|
||||
// CHECK_EQUAL(1, motorControl.null);
|
||||
//}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_fsm_emergency_stop)
|
||||
{
|
||||
@ -447,6 +583,7 @@ namespace
|
||||
|
||||
// Now in Running state.
|
||||
|
||||
// Send abort event.
|
||||
motorControl.process_event(EventId::ABORT);
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControl.get_state_id()));
|
||||
|
||||
|
||||
612
test/test_state_chart_compile_time.cpp
Normal file
612
test/test_state_chart_compile_time.cpp
Normal file
@ -0,0 +1,612 @@
|
||||
/******************************************************************************
|
||||
The MIT License(MIT)
|
||||
|
||||
Embedded Template Library.
|
||||
https://github.com/ETLCPP/etl
|
||||
https://www.etlcpp.com
|
||||
|
||||
Copyright(c) 2018 jwellbelove
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files(the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions :
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "unit_test_framework.h"
|
||||
|
||||
#include "etl/state_chart.h"
|
||||
#include "etl/enum_type.h"
|
||||
#include "etl/queue.h"
|
||||
#include "etl/array.h"
|
||||
|
||||
#include <iterator>
|
||||
#include <iostream>
|
||||
|
||||
namespace
|
||||
{
|
||||
//***************************************************************************
|
||||
// Events
|
||||
struct EventId
|
||||
{
|
||||
enum enum_type
|
||||
{
|
||||
START,
|
||||
STOP,
|
||||
EMERGENCY_STOP,
|
||||
STOPPED,
|
||||
SET_SPEED,
|
||||
ABORT
|
||||
};
|
||||
|
||||
ETL_DECLARE_ENUM_TYPE(EventId, etl::state_chart_traits::event_id_t)
|
||||
ETL_ENUM_TYPE(START, "Start")
|
||||
ETL_ENUM_TYPE(STOP, "Stop")
|
||||
ETL_ENUM_TYPE(EMERGENCY_STOP, "Emergency Stop")
|
||||
ETL_ENUM_TYPE(STOPPED, "Stopped")
|
||||
ETL_ENUM_TYPE(SET_SPEED, "Set Speed")
|
||||
ETL_ENUM_TYPE(ABORT, "Abort")
|
||||
ETL_END_ENUM_TYPE
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
// States
|
||||
struct StateId
|
||||
{
|
||||
enum enum_type
|
||||
{
|
||||
IDLE,
|
||||
RUNNING,
|
||||
WINDING_DOWN,
|
||||
NUMBER_OF_STATES
|
||||
};
|
||||
|
||||
ETL_DECLARE_ENUM_TYPE(StateId, etl::state_chart_traits::state_id_t)
|
||||
ETL_ENUM_TYPE(IDLE, "Idle")
|
||||
ETL_ENUM_TYPE(RUNNING, "Running")
|
||||
ETL_ENUM_TYPE(WINDING_DOWN, "Winding Down")
|
||||
ETL_END_ENUM_TYPE
|
||||
};
|
||||
|
||||
//***********************************
|
||||
// The motor control FSM.
|
||||
//***********************************
|
||||
class MotorControl
|
||||
{
|
||||
public:
|
||||
|
||||
MotorControl()
|
||||
{
|
||||
ClearStatistics();
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void ClearStatistics()
|
||||
{
|
||||
startCount = 0;
|
||||
stopCount = 0;
|
||||
setSpeedCount = 0;
|
||||
stoppedCount = 0;
|
||||
isLampOn = false;
|
||||
speed = 0;
|
||||
windingDown = 0;
|
||||
entered_idle = false;
|
||||
null = 0;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void OnStart()
|
||||
{
|
||||
++startCount;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void OnStop()
|
||||
{
|
||||
++stopCount;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void OnStopped()
|
||||
{
|
||||
++stoppedCount;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void OnSetSpeed()
|
||||
{
|
||||
++setSpeedCount;
|
||||
SetSpeedValue(100);
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void OnEnterIdle()
|
||||
{
|
||||
TurnRunningLampOff();
|
||||
entered_idle = true;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void OnEnterRunning()
|
||||
{
|
||||
TurnRunningLampOn();
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void OnEnterWindingDown()
|
||||
{
|
||||
++windingDown;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void OnExitWindingDown()
|
||||
{
|
||||
--windingDown;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void SetSpeedValue(int speed_)
|
||||
{
|
||||
speed = speed_;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
bool Guard()
|
||||
{
|
||||
return guard;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
bool NotGuard()
|
||||
{
|
||||
return !guard;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void TurnRunningLampOn()
|
||||
{
|
||||
isLampOn = true;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void TurnRunningLampOff()
|
||||
{
|
||||
isLampOn = false;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void Null()
|
||||
{
|
||||
++null;
|
||||
}
|
||||
|
||||
int startCount;
|
||||
int stopCount;
|
||||
int setSpeedCount;
|
||||
int stoppedCount;
|
||||
bool isLampOn;
|
||||
int speed;
|
||||
int windingDown;
|
||||
bool entered_idle;
|
||||
int null;
|
||||
|
||||
bool guard;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
using transition = etl::state_chart_traits::transition<MotorControl>;
|
||||
|
||||
constexpr transition transitionTable[7] =
|
||||
{
|
||||
transition(StateId::IDLE, EventId::START, StateId::RUNNING, &MotorControl::OnStart, &MotorControl::Guard),
|
||||
transition(StateId::IDLE, EventId::START, StateId::IDLE, &MotorControl::Null, &MotorControl::NotGuard),
|
||||
transition(StateId::RUNNING, EventId::STOP, StateId::WINDING_DOWN, &MotorControl::OnStop),
|
||||
transition(StateId::RUNNING, EventId::EMERGENCY_STOP, StateId::IDLE, &MotorControl::OnStop),
|
||||
transition(StateId::RUNNING, EventId::SET_SPEED, StateId::RUNNING, &MotorControl::OnSetSpeed),
|
||||
transition(StateId::WINDING_DOWN, EventId::STOPPED, StateId::IDLE, &MotorControl::OnStopped),
|
||||
transition( EventId::ABORT, StateId::IDLE)
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
using state = etl::state_chart_traits::state<MotorControl>;
|
||||
|
||||
constexpr state stateTable[3] =
|
||||
{
|
||||
state(StateId::IDLE, &MotorControl::OnEnterIdle, nullptr),
|
||||
state(StateId::RUNNING, &MotorControl::OnEnterRunning, nullptr),
|
||||
state(StateId::WINDING_DOWN, &MotorControl::OnEnterWindingDown, &MotorControl::OnExitWindingDown)
|
||||
};
|
||||
|
||||
MotorControl motorControl;
|
||||
|
||||
etl::state_chart_ct<MotorControl,
|
||||
motorControl,
|
||||
transitionTable,
|
||||
7,
|
||||
stateTable,
|
||||
3,
|
||||
StateId::IDLE> motorControlStateChart;
|
||||
|
||||
SUITE(test_state_chart_compile_time)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(test_state_chart)
|
||||
{
|
||||
motorControl.ClearStatistics();
|
||||
|
||||
// In Idle state.
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(0, motorControl.speed);
|
||||
CHECK_EQUAL(0, motorControl.startCount);
|
||||
CHECK_EQUAL(0, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
CHECK_EQUAL(false, motorControl.entered_idle);
|
||||
|
||||
// Send Start event (state chart not started).
|
||||
motorControl.guard = true;
|
||||
motorControlStateChart.process_event(EventId::START);
|
||||
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(0, motorControl.speed);
|
||||
CHECK_EQUAL(0, motorControl.startCount);
|
||||
CHECK_EQUAL(0, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
CHECK_EQUAL(false, motorControl.entered_idle);
|
||||
|
||||
// Start the state chart
|
||||
motorControl.guard = true;
|
||||
motorControlStateChart.start();
|
||||
|
||||
CHECK_EQUAL(true, motorControl.entered_idle);
|
||||
|
||||
// Send unhandled events.
|
||||
motorControlStateChart.process_event(EventId::STOP);
|
||||
motorControlStateChart.process_event(EventId::STOPPED);
|
||||
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(0, motorControl.speed);
|
||||
CHECK_EQUAL(0, motorControl.startCount);
|
||||
CHECK_EQUAL(0, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
|
||||
// Send Start event.
|
||||
motorControl.guard = false;
|
||||
motorControlStateChart.process_event(EventId::START);
|
||||
|
||||
// Still in Idle state.
|
||||
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(0, motorControl.speed);
|
||||
CHECK_EQUAL(0, motorControl.startCount);
|
||||
CHECK_EQUAL(0, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// Send Start event.
|
||||
motorControl.guard = true;
|
||||
motorControlStateChart.process_event(EventId::START);
|
||||
|
||||
// Now in Running state.
|
||||
|
||||
CHECK_EQUAL(StateId::RUNNING, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(0, motorControl.speed);
|
||||
CHECK_EQUAL(1, motorControl.startCount);
|
||||
CHECK_EQUAL(0, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// Send unhandled events.
|
||||
motorControlStateChart.process_event(EventId::START);
|
||||
motorControlStateChart.process_event(EventId::STOPPED);
|
||||
|
||||
CHECK_EQUAL(StateId::RUNNING, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(0, motorControl.speed);
|
||||
CHECK_EQUAL(1, motorControl.startCount);
|
||||
CHECK_EQUAL(0, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// Send SetSpeed event.
|
||||
motorControlStateChart.process_event(EventId::SET_SPEED);
|
||||
|
||||
// Still in Running state.
|
||||
|
||||
CHECK_EQUAL(StateId::RUNNING, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
CHECK_EQUAL(1, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(100, motorControl.speed);
|
||||
CHECK_EQUAL(1, motorControl.startCount);
|
||||
CHECK_EQUAL(0, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// Send Stop event.
|
||||
motorControlStateChart.process_event(EventId::STOP);
|
||||
|
||||
// Now in WindingDown state.
|
||||
|
||||
CHECK_EQUAL(StateId::WINDING_DOWN, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
CHECK_EQUAL(1, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(100, motorControl.speed);
|
||||
CHECK_EQUAL(1, motorControl.startCount);
|
||||
CHECK_EQUAL(1, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(1, motorControl.windingDown);
|
||||
CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// Send unhandled events.
|
||||
motorControlStateChart.process_event(EventId::START);
|
||||
motorControlStateChart.process_event(EventId::STOP);
|
||||
|
||||
CHECK_EQUAL(StateId::WINDING_DOWN, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
CHECK_EQUAL(1, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(100, motorControl.speed);
|
||||
CHECK_EQUAL(1, motorControl.startCount);
|
||||
CHECK_EQUAL(1, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(1, motorControl.windingDown);
|
||||
CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// Send Stopped event.
|
||||
motorControlStateChart.process_event(EventId::STOPPED);
|
||||
|
||||
// Now in Idle state.
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
CHECK_EQUAL(1, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(100, motorControl.speed);
|
||||
CHECK_EQUAL(1, motorControl.startCount);
|
||||
CHECK_EQUAL(1, motorControl.stopCount);
|
||||
CHECK_EQUAL(1, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
CHECK_EQUAL(1, motorControl.null);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
//TEST(test_state_chart_with_delegate)
|
||||
//{
|
||||
// motorControl.ClearStatistics();
|
||||
|
||||
// auto process_event = motorControlStateChart.get_process_event_delegate();
|
||||
|
||||
// // Start the state chart
|
||||
// motorControl.guard = true;
|
||||
// motorControlStateChart.start();
|
||||
|
||||
// // Send unhandled events.
|
||||
// process_event(EventId::STOP);
|
||||
// process_event(EventId::STOPPED);
|
||||
|
||||
// CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(0, motorControl.speed);
|
||||
// CHECK_EQUAL(0, motorControl.startCount);
|
||||
// CHECK_EQUAL(0, motorControl.stopCount);
|
||||
// CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(0, motorControl.windingDown);
|
||||
|
||||
// // Send Start event.
|
||||
// motorControl.guard = false;
|
||||
// process_event(EventId::START);
|
||||
|
||||
// // Still in Idle state.
|
||||
|
||||
// CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(0, motorControl.speed);
|
||||
// CHECK_EQUAL(0, motorControl.startCount);
|
||||
// CHECK_EQUAL(0, motorControl.stopCount);
|
||||
// CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(0, motorControl.windingDown);
|
||||
// CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// // Send Start event.
|
||||
// motorControl.guard = true;
|
||||
// process_event(EventId::START);
|
||||
|
||||
// // Now in Running state.
|
||||
|
||||
// CHECK_EQUAL(StateId::RUNNING, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(0, motorControl.speed);
|
||||
// CHECK_EQUAL(1, motorControl.startCount);
|
||||
// CHECK_EQUAL(0, motorControl.stopCount);
|
||||
// CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(0, motorControl.windingDown);
|
||||
// CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// // Send unhandled events.
|
||||
// process_event(EventId::START);
|
||||
// process_event(EventId::STOPPED);
|
||||
|
||||
// CHECK_EQUAL(StateId::RUNNING, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(0, motorControl.speed);
|
||||
// CHECK_EQUAL(1, motorControl.startCount);
|
||||
// CHECK_EQUAL(0, motorControl.stopCount);
|
||||
// CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(0, motorControl.windingDown);
|
||||
// CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// // Send SetSpeed event.
|
||||
// process_event(EventId::SET_SPEED);
|
||||
|
||||
// // Still in Running state.
|
||||
|
||||
// CHECK_EQUAL(StateId::RUNNING, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(1, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(100, motorControl.speed);
|
||||
// CHECK_EQUAL(1, motorControl.startCount);
|
||||
// CHECK_EQUAL(0, motorControl.stopCount);
|
||||
// CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(0, motorControl.windingDown);
|
||||
// CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// // Send Stop event.
|
||||
// process_event(EventId::STOP);
|
||||
|
||||
// // Now in WindingDown state.
|
||||
|
||||
// CHECK_EQUAL(StateId::WINDING_DOWN, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(1, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(100, motorControl.speed);
|
||||
// CHECK_EQUAL(1, motorControl.startCount);
|
||||
// CHECK_EQUAL(1, motorControl.stopCount);
|
||||
// CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(1, motorControl.windingDown);
|
||||
// CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// // Send unhandled events.
|
||||
// process_event(EventId::START);
|
||||
// process_event(EventId::STOP);
|
||||
|
||||
// CHECK_EQUAL(StateId::WINDING_DOWN, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(1, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(100, motorControl.speed);
|
||||
// CHECK_EQUAL(1, motorControl.startCount);
|
||||
// CHECK_EQUAL(1, motorControl.stopCount);
|
||||
// CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(1, motorControl.windingDown);
|
||||
// CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// // Send Stopped event.
|
||||
// process_event(EventId::STOPPED);
|
||||
|
||||
// // Now in Idle state.
|
||||
// CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(1, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(100, motorControl.speed);
|
||||
// CHECK_EQUAL(1, motorControl.startCount);
|
||||
// CHECK_EQUAL(1, motorControl.stopCount);
|
||||
// CHECK_EQUAL(1, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(0, motorControl.windingDown);
|
||||
// CHECK_EQUAL(1, motorControl.null);
|
||||
//}
|
||||
|
||||
////*************************************************************************
|
||||
//TEST(test_fsm_emergency_stop)
|
||||
//{
|
||||
// motorControl.ClearStatistics();
|
||||
|
||||
// // Now in Idle state.
|
||||
|
||||
// // Send Start event.
|
||||
// motorControlStateChart.process_event(EventId::START);
|
||||
|
||||
// // Now in Running state.
|
||||
|
||||
// CHECK_EQUAL(StateId::RUNNING, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(0, motorControl.speed);
|
||||
// CHECK_EQUAL(1, motorControl.startCount);
|
||||
// CHECK_EQUAL(0, motorControl.stopCount);
|
||||
// CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(0, motorControl.windingDown);
|
||||
|
||||
// // Send emergency Stop event.
|
||||
// motorControlStateChart.process_event(EventId::EMERGENCY_STOP);
|
||||
|
||||
// // Now in Idle state.
|
||||
// CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
// CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
// CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
// CHECK_EQUAL(0, motorControl.speed);
|
||||
// CHECK_EQUAL(1, motorControl.startCount);
|
||||
// CHECK_EQUAL(1, motorControl.stopCount);
|
||||
// CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
// CHECK_EQUAL(0, motorControl.windingDown);
|
||||
//}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_fsm_abort)
|
||||
{
|
||||
motorControl.ClearStatistics();
|
||||
|
||||
// Now in Idle state.
|
||||
|
||||
// Send Start event.
|
||||
motorControlStateChart.process_event(EventId::START);
|
||||
|
||||
// Now in Running state.
|
||||
|
||||
// Send abort event.
|
||||
motorControlStateChart.process_event(EventId::ABORT);
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
// Send Start event.
|
||||
motorControlStateChart.process_event(EventId::START);
|
||||
|
||||
// Now in Running state.
|
||||
|
||||
// Send Stop event.
|
||||
motorControlStateChart.process_event(EventId::STOP);
|
||||
|
||||
// Now in WindingDown state.
|
||||
motorControlStateChart.process_event(EventId::ABORT);
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
}
|
||||
};
|
||||
}
|
||||
508
test/test_state_chart_compile_time_with_data_parameter.cpp
Normal file
508
test/test_state_chart_compile_time_with_data_parameter.cpp
Normal file
@ -0,0 +1,508 @@
|
||||
/******************************************************************************
|
||||
The MIT License(MIT)
|
||||
|
||||
Embedded Template Library.
|
||||
https://github.com/ETLCPP/etl
|
||||
https://www.etlcpp.com
|
||||
|
||||
Copyright(c) 2018 jwellbelove
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files(the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions :
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "unit_test_framework.h"
|
||||
|
||||
#include "etl/state_chart.h"
|
||||
#include "etl/enum_type.h"
|
||||
#include "etl/queue.h"
|
||||
#include "etl/array.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace
|
||||
{
|
||||
//***************************************************************************
|
||||
// Events
|
||||
struct EventId
|
||||
{
|
||||
enum enum_type
|
||||
{
|
||||
START,
|
||||
STOP,
|
||||
EMERGENCY_STOP,
|
||||
STOPPED,
|
||||
SET_SPEED,
|
||||
ABORT
|
||||
};
|
||||
|
||||
ETL_DECLARE_ENUM_TYPE(EventId, etl::state_chart_traits::event_id_t)
|
||||
ETL_ENUM_TYPE(START, "Start")
|
||||
ETL_ENUM_TYPE(STOP, "Stop")
|
||||
ETL_ENUM_TYPE(EMERGENCY_STOP, "Emergency Stop")
|
||||
ETL_ENUM_TYPE(STOPPED, "Stopped")
|
||||
ETL_ENUM_TYPE(SET_SPEED, "Set Speed")
|
||||
ETL_ENUM_TYPE(ABORT, "Abort")
|
||||
ETL_END_ENUM_TYPE
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
// States
|
||||
struct StateId
|
||||
{
|
||||
enum enum_type
|
||||
{
|
||||
IDLE,
|
||||
RUNNING,
|
||||
WINDING_DOWN,
|
||||
NUMBER_OF_STATES
|
||||
};
|
||||
|
||||
ETL_DECLARE_ENUM_TYPE(StateId, etl::state_chart_traits::state_id_t)
|
||||
ETL_ENUM_TYPE(IDLE, "Idle")
|
||||
ETL_ENUM_TYPE(RUNNING, "Running")
|
||||
ETL_ENUM_TYPE(WINDING_DOWN, "Winding Down")
|
||||
ETL_END_ENUM_TYPE
|
||||
};
|
||||
|
||||
//***********************************
|
||||
// The motor control FSM.
|
||||
//***********************************
|
||||
class MotorControl
|
||||
{
|
||||
public:
|
||||
|
||||
MotorControl()
|
||||
{
|
||||
ClearStatistics();
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void ClearStatistics()
|
||||
{
|
||||
startCount = 0;
|
||||
stopCount = 0;
|
||||
setSpeedCount = 0;
|
||||
stoppedCount = 0;
|
||||
isLampOn = false;
|
||||
speed = 0;
|
||||
windingDown = 0;
|
||||
entered_idle = false;
|
||||
null = 0;
|
||||
data = 0;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void OnStart(int d)
|
||||
{
|
||||
data = d;
|
||||
++startCount;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void OnStop(int d)
|
||||
{
|
||||
data = d;
|
||||
++stopCount;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void OnStopped(int d)
|
||||
{
|
||||
data = d;
|
||||
++stoppedCount;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void OnSetSpeed(int d)
|
||||
{
|
||||
data = d;
|
||||
++setSpeedCount;
|
||||
SetSpeedValue(100);
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void OnEnterIdle()
|
||||
{
|
||||
TurnRunningLampOff();
|
||||
entered_idle = true;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void OnEnterRunning()
|
||||
{
|
||||
TurnRunningLampOn();
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void OnEnterWindingDown()
|
||||
{
|
||||
++windingDown;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void OnExitWindingDown()
|
||||
{
|
||||
--windingDown;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void SetSpeedValue(int speed_)
|
||||
{
|
||||
speed = speed_;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
bool Guard()
|
||||
{
|
||||
return guard;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
bool NotGuard()
|
||||
{
|
||||
return !guard;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void TurnRunningLampOn()
|
||||
{
|
||||
isLampOn = true;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void TurnRunningLampOff()
|
||||
{
|
||||
isLampOn = false;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
void Null(int d)
|
||||
{
|
||||
data = d;
|
||||
++null;
|
||||
}
|
||||
|
||||
int startCount;
|
||||
int stopCount;
|
||||
int setSpeedCount;
|
||||
int stoppedCount;
|
||||
bool isLampOn;
|
||||
int speed;
|
||||
int windingDown;
|
||||
bool entered_idle;
|
||||
int null;
|
||||
int data;
|
||||
|
||||
bool guard;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
using transition = etl::state_chart_traits::transition<MotorControl, int>;
|
||||
|
||||
constexpr transition transitionTable[7] =
|
||||
{
|
||||
transition(StateId::IDLE, EventId::START, StateId::RUNNING, &MotorControl::OnStart, &MotorControl::Guard),
|
||||
transition(StateId::IDLE, EventId::START, StateId::IDLE, &MotorControl::Null, &MotorControl::NotGuard),
|
||||
transition(StateId::RUNNING, EventId::STOP, StateId::WINDING_DOWN, &MotorControl::OnStop),
|
||||
transition(StateId::RUNNING, EventId::EMERGENCY_STOP, StateId::IDLE, &MotorControl::OnStop),
|
||||
transition(StateId::RUNNING, EventId::SET_SPEED, StateId::RUNNING, &MotorControl::OnSetSpeed),
|
||||
transition(StateId::WINDING_DOWN, EventId::STOPPED, StateId::IDLE, &MotorControl::OnStopped),
|
||||
transition(EventId::ABORT, StateId::IDLE)
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
using state = etl::state_chart_traits::state<MotorControl>;
|
||||
|
||||
constexpr state stateTable[3] =
|
||||
{
|
||||
state(StateId::IDLE, &MotorControl::OnEnterIdle, nullptr),
|
||||
state(StateId::RUNNING, &MotorControl::OnEnterRunning, nullptr),
|
||||
state(StateId::WINDING_DOWN, &MotorControl::OnEnterWindingDown, &MotorControl::OnExitWindingDown)
|
||||
};
|
||||
|
||||
MotorControl motorControl;
|
||||
|
||||
etl::state_chart_ctp<MotorControl,
|
||||
int,
|
||||
motorControl,
|
||||
transitionTable,
|
||||
7,
|
||||
stateTable,
|
||||
3,
|
||||
StateId::IDLE> motorControlStateChart;
|
||||
|
||||
SUITE(test_state_chart_compile_time_with_data_parameter)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(test_state_chart)
|
||||
{
|
||||
motorControl.ClearStatistics();
|
||||
|
||||
// In Idle state.
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(0, motorControl.speed);
|
||||
CHECK_EQUAL(0, motorControl.startCount);
|
||||
CHECK_EQUAL(0, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
CHECK_EQUAL(false, motorControl.entered_idle);
|
||||
|
||||
// Send Start event (state chart not started).
|
||||
motorControl.guard = true;
|
||||
motorControlStateChart.process_event(EventId::START, 1);
|
||||
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(0, motorControl.data);
|
||||
CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(0, motorControl.speed);
|
||||
CHECK_EQUAL(0, motorControl.startCount);
|
||||
CHECK_EQUAL(0, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
CHECK_EQUAL(false, motorControl.entered_idle);
|
||||
|
||||
// Start the state chart
|
||||
motorControl.guard = true;
|
||||
motorControlStateChart.start();
|
||||
|
||||
CHECK_EQUAL(true, motorControl.entered_idle);
|
||||
|
||||
// Send unhandled events.
|
||||
motorControlStateChart.process_event(EventId::STOP, 2);
|
||||
motorControlStateChart.process_event(EventId::STOPPED, 3);
|
||||
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(0, motorControl.data);
|
||||
CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(0, motorControl.speed);
|
||||
CHECK_EQUAL(0, motorControl.startCount);
|
||||
CHECK_EQUAL(0, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
|
||||
// Send Start event.
|
||||
motorControl.guard = false;
|
||||
motorControlStateChart.process_event(EventId::START, 4);
|
||||
|
||||
// Still in Idle state.
|
||||
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(4, motorControl.data);
|
||||
CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(0, motorControl.speed);
|
||||
CHECK_EQUAL(0, motorControl.startCount);
|
||||
CHECK_EQUAL(0, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// Send Start event.
|
||||
motorControl.guard = true;
|
||||
motorControlStateChart.process_event(EventId::START, 5);
|
||||
|
||||
// Now in Running state.
|
||||
|
||||
CHECK_EQUAL(StateId::RUNNING, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(5, motorControl.data);
|
||||
CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(0, motorControl.speed);
|
||||
CHECK_EQUAL(1, motorControl.startCount);
|
||||
CHECK_EQUAL(0, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// Send unhandled events.
|
||||
motorControlStateChart.process_event(EventId::START, 6);
|
||||
motorControlStateChart.process_event(EventId::STOPPED, 7);
|
||||
|
||||
CHECK_EQUAL(StateId::RUNNING, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(5, motorControl.data);
|
||||
CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(0, motorControl.speed);
|
||||
CHECK_EQUAL(1, motorControl.startCount);
|
||||
CHECK_EQUAL(0, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// Send SetSpeed event.
|
||||
motorControlStateChart.process_event(EventId::SET_SPEED, 8);
|
||||
|
||||
// Still in Running state.
|
||||
|
||||
CHECK_EQUAL(StateId::RUNNING, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(8, motorControl.data);
|
||||
CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
CHECK_EQUAL(1, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(100, motorControl.speed);
|
||||
CHECK_EQUAL(1, motorControl.startCount);
|
||||
CHECK_EQUAL(0, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// Send Stop event.
|
||||
motorControlStateChart.process_event(EventId::STOP, 9);
|
||||
|
||||
// Now in WindingDown state.
|
||||
|
||||
CHECK_EQUAL(StateId::WINDING_DOWN, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(9, motorControl.data);
|
||||
CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
CHECK_EQUAL(1, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(100, motorControl.speed);
|
||||
CHECK_EQUAL(1, motorControl.startCount);
|
||||
CHECK_EQUAL(1, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(1, motorControl.windingDown);
|
||||
CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// Send unhandled events.
|
||||
motorControlStateChart.process_event(EventId::START, 10);
|
||||
motorControlStateChart.process_event(EventId::STOP, 11);
|
||||
|
||||
CHECK_EQUAL(StateId::WINDING_DOWN, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(9, motorControl.data);
|
||||
CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
CHECK_EQUAL(1, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(100, motorControl.speed);
|
||||
CHECK_EQUAL(1, motorControl.startCount);
|
||||
CHECK_EQUAL(1, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(1, motorControl.windingDown);
|
||||
CHECK_EQUAL(1, motorControl.null);
|
||||
|
||||
// Send Stopped event.
|
||||
motorControlStateChart.process_event(EventId::STOPPED, 12);
|
||||
|
||||
// Now in Idle state.
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(12, motorControl.data);
|
||||
CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
CHECK_EQUAL(1, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(100, motorControl.speed);
|
||||
CHECK_EQUAL(1, motorControl.startCount);
|
||||
CHECK_EQUAL(1, motorControl.stopCount);
|
||||
CHECK_EQUAL(1, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
CHECK_EQUAL(1, motorControl.null);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_fsm_emergency_stop)
|
||||
{
|
||||
motorControl.ClearStatistics();
|
||||
|
||||
// Now in Idle state.
|
||||
|
||||
// Send Start event.
|
||||
motorControlStateChart.process_event(EventId::START, 1);
|
||||
|
||||
// Now in Running state.
|
||||
|
||||
CHECK_EQUAL(StateId::RUNNING, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(1, motorControl.data);
|
||||
CHECK_EQUAL(true, motorControl.isLampOn);
|
||||
CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(0, motorControl.speed);
|
||||
CHECK_EQUAL(1, motorControl.startCount);
|
||||
CHECK_EQUAL(0, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
|
||||
// Send emergency Stop event.
|
||||
motorControlStateChart.process_event(EventId::EMERGENCY_STOP, 2);
|
||||
|
||||
// Now in Idle state.
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
|
||||
CHECK_EQUAL(2, motorControl.data);
|
||||
CHECK_EQUAL(false, motorControl.isLampOn);
|
||||
CHECK_EQUAL(0, motorControl.setSpeedCount);
|
||||
CHECK_EQUAL(0, motorControl.speed);
|
||||
CHECK_EQUAL(1, motorControl.startCount);
|
||||
CHECK_EQUAL(1, motorControl.stopCount);
|
||||
CHECK_EQUAL(0, motorControl.stoppedCount);
|
||||
CHECK_EQUAL(0, motorControl.windingDown);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_fsm_abort)
|
||||
{
|
||||
motorControl.ClearStatistics();
|
||||
|
||||
// Now in Idle state.
|
||||
|
||||
// Send Start event.
|
||||
motorControlStateChart.process_event(EventId::START, 1);
|
||||
|
||||
int state = int(motorControlStateChart.get_state_id());
|
||||
int check = StateId::RUNNING;
|
||||
|
||||
// Now in Running state.
|
||||
|
||||
// Send abort event.
|
||||
motorControlStateChart.process_event(EventId::ABORT, 2);
|
||||
|
||||
state = int(motorControlStateChart.get_state_id());
|
||||
check = StateId::IDLE;
|
||||
|
||||
CHECK_EQUAL(check, state);
|
||||
//CHECK_EQUAL(StateId::IDLE, state);
|
||||
//CHECK_EQUAL(StateId::IDLE, int(motorControl.get_state_id()));
|
||||
|
||||
// Send Start event.
|
||||
motorControlStateChart.process_event(EventId::START, 3);
|
||||
|
||||
// Now in Running state.
|
||||
|
||||
state = int(motorControlStateChart.get_state_id());
|
||||
check = StateId::RUNNING;
|
||||
|
||||
// Send Stop event.
|
||||
motorControlStateChart.process_event(EventId::STOP, 4);
|
||||
|
||||
state = int(motorControlStateChart.get_state_id());
|
||||
check = StateId::WINDING_DOWN;
|
||||
|
||||
// Now in WindingDown state.
|
||||
motorControlStateChart.process_event(EventId::ABORT, 5);
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControlStateChart.get_state_id()));
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -51,7 +51,7 @@ namespace
|
||||
ABORT
|
||||
};
|
||||
|
||||
ETL_DECLARE_ENUM_TYPE(EventId, etl::istate_chart::event_id_t)
|
||||
ETL_DECLARE_ENUM_TYPE(EventId, etl::state_chart_traits::event_id_t)
|
||||
ETL_ENUM_TYPE(START, "Start")
|
||||
ETL_ENUM_TYPE(STOP, "Stop")
|
||||
ETL_ENUM_TYPE(EMERGENCY_STOP, "Emergency Stop")
|
||||
@ -73,7 +73,7 @@ namespace
|
||||
NUMBER_OF_STATES
|
||||
};
|
||||
|
||||
ETL_DECLARE_ENUM_TYPE(StateId, etl::istate_chart::state_id_t)
|
||||
ETL_DECLARE_ENUM_TYPE(StateId, etl::state_chart_traits::state_id_t)
|
||||
ETL_ENUM_TYPE(IDLE, "Idle")
|
||||
ETL_ENUM_TYPE(RUNNING, "Running")
|
||||
ETL_ENUM_TYPE(WINDING_DOWN, "Winding Down")
|
||||
@ -88,9 +88,8 @@ namespace
|
||||
public:
|
||||
|
||||
MotorControl()
|
||||
: state_chart<MotorControl, int>(*this, transitionTable.begin(), transitionTable.end(), StateId::IDLE)
|
||||
: etl::state_chart<MotorControl, int>(*this, transitionTable.begin(), transitionTable.end(), stateTable.begin(), stateTable.end(), StateId::IDLE)
|
||||
{
|
||||
this->set_state_table(stateTable.begin(), stateTable.end());
|
||||
ClearStatistics();
|
||||
}
|
||||
|
||||
@ -239,7 +238,7 @@ namespace
|
||||
|
||||
MotorControl motorControl;
|
||||
|
||||
SUITE(test_state_chart_class)
|
||||
SUITE(test_state_chart_with_data_parameter)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(test_state_chart)
|
||||
@ -463,19 +462,35 @@ namespace
|
||||
// Send Start event.
|
||||
motorControl.process_event(EventId::START, 1);
|
||||
|
||||
int state = int(motorControl.get_state_id());
|
||||
int check = StateId::RUNNING;
|
||||
|
||||
// Now in Running state.
|
||||
|
||||
// Send abort event.
|
||||
motorControl.process_event(EventId::ABORT, 2);
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControl.get_state_id()));
|
||||
|
||||
state = int(motorControl.get_state_id());
|
||||
check = StateId::IDLE;
|
||||
|
||||
CHECK_EQUAL(check, state);
|
||||
//CHECK_EQUAL(StateId::IDLE, state);
|
||||
//CHECK_EQUAL(StateId::IDLE, int(motorControl.get_state_id()));
|
||||
|
||||
// Send Start event.
|
||||
motorControl.process_event(EventId::START, 3);
|
||||
|
||||
// Now in Running state.
|
||||
|
||||
state = int(motorControl.get_state_id());
|
||||
check = StateId::RUNNING;
|
||||
|
||||
// Send Stop event.
|
||||
motorControl.process_event(EventId::STOP, 4);
|
||||
|
||||
state = int(motorControl.get_state_id());
|
||||
check = StateId::WINDING_DOWN;
|
||||
|
||||
// Now in WindingDown state.
|
||||
motorControl.process_event(EventId::ABORT, 5);
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControl.get_state_id()));
|
||||
|
||||
@ -51,7 +51,7 @@ namespace
|
||||
ABORT
|
||||
};
|
||||
|
||||
ETL_DECLARE_ENUM_TYPE(EventId, etl::istate_chart::event_id_t)
|
||||
ETL_DECLARE_ENUM_TYPE(EventId, etl::state_chart_traits::event_id_t)
|
||||
ETL_ENUM_TYPE(START, "Start")
|
||||
ETL_ENUM_TYPE(STOP, "Stop")
|
||||
ETL_ENUM_TYPE(EMERGENCY_STOP, "Emergency Stop")
|
||||
@ -73,7 +73,7 @@ namespace
|
||||
NUMBER_OF_STATES
|
||||
};
|
||||
|
||||
ETL_DECLARE_ENUM_TYPE(StateId, etl::istate_chart::state_id_t)
|
||||
ETL_DECLARE_ENUM_TYPE(StateId, etl::state_chart_traits::state_id_t)
|
||||
ETL_ENUM_TYPE(IDLE, "Idle")
|
||||
ETL_ENUM_TYPE(RUNNING, "Running")
|
||||
ETL_ENUM_TYPE(WINDING_DOWN, "Winding Down")
|
||||
@ -119,9 +119,8 @@ namespace
|
||||
public:
|
||||
|
||||
MotorControl()
|
||||
: state_chart<MotorControl, Data&&>(*this, transitionTable.begin(), transitionTable.end(), StateId::IDLE)
|
||||
: state_chart<MotorControl, Data&&>(*this, transitionTable.begin(), transitionTable.end(), stateTable.begin(), stateTable.end(), StateId::IDLE)
|
||||
{
|
||||
this->set_state_table(stateTable.begin(), stateTable.end());
|
||||
ClearStatistics();
|
||||
}
|
||||
|
||||
@ -273,7 +272,7 @@ namespace
|
||||
SUITE(test_state_chart_class)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(test_state_chart)
|
||||
TEST(test_state_chart_with_rvalue_data_parameter)
|
||||
{
|
||||
motorControl.ClearStatistics();
|
||||
|
||||
@ -496,6 +495,7 @@ namespace
|
||||
|
||||
// Now in Running state.
|
||||
|
||||
// Send abort event.
|
||||
motorControl.process_event(EventId::ABORT, Data(2));
|
||||
CHECK_EQUAL(StateId::IDLE, int(motorControl.get_state_id()));
|
||||
|
||||
|
||||
@ -150,7 +150,7 @@ namespace
|
||||
CHECK_EQUAL(sizeof(signed char), etl::host_schar_t::Size);
|
||||
CHECK_EQUAL(sizeof(unsigned char), etl::host_uchar_t::Size);
|
||||
CHECK_EQUAL(sizeof(short), etl::host_short_t::Size);
|
||||
CHECK_EQUAL(sizeof(unsigned short), etl::host_uint_t::Size);
|
||||
CHECK_EQUAL(sizeof(unsigned short), etl::host_ushort_t::Size);
|
||||
CHECK_EQUAL(sizeof(int), etl::host_int_t::Size);
|
||||
CHECK_EQUAL(sizeof(unsigned int), etl::host_uint_t::Size);
|
||||
CHECK_EQUAL(sizeof(long), etl::host_long_t::Size);
|
||||
@ -181,12 +181,12 @@ namespace
|
||||
CHECK(etl::le_char_t(0x01) == char(0x01));
|
||||
|
||||
CHECK(etl::le_schar_t(0x01) == etl::le_schar_t(0x01));
|
||||
CHECK(signed char(0x01) == etl::le_schar_t(0x01));
|
||||
CHECK(etl::le_schar_t(0x01) == signed char(0x01));
|
||||
CHECK((signed char)(0x01) == etl::le_schar_t(0x01));
|
||||
CHECK(etl::le_schar_t(0x01) == (signed char)(0x01));
|
||||
|
||||
CHECK(etl::le_uchar_t(0x01U) == etl::le_uchar_t(0x01U));
|
||||
CHECK(unsigned char(0x01U) == etl::le_uchar_t(0x01U));
|
||||
CHECK(etl::le_uchar_t(0x01U) == unsigned char(0x01U));
|
||||
CHECK((unsigned char)(0x01U) == etl::le_uchar_t(0x01U));
|
||||
CHECK(etl::le_uchar_t(0x01U) == (unsigned char)(0x01U));
|
||||
|
||||
// short
|
||||
CHECK(etl::le_short_t(0x0123) == etl::le_short_t(0x0123));
|
||||
@ -194,8 +194,8 @@ namespace
|
||||
CHECK(etl::le_short_t(0x0123) == short(0x0123));
|
||||
|
||||
CHECK(etl::le_ushort_t(0x0123) == etl::le_ushort_t(0x0123));
|
||||
CHECK(unsigned short(0x0123) == etl::le_ushort_t(0x0123));
|
||||
CHECK(etl::le_ushort_t(0x0123) == unsigned short(0x0123));
|
||||
CHECK((unsigned short)(0x0123) == etl::le_ushort_t(0x0123));
|
||||
CHECK(etl::le_ushort_t(0x0123) == (unsigned short)(0x0123));
|
||||
|
||||
// int
|
||||
CHECK(etl::le_int_t(0x012345678) == etl::le_int_t(0x012345678));
|
||||
@ -203,8 +203,8 @@ namespace
|
||||
CHECK(etl::le_int_t(0x012345678) == int(0x012345678));
|
||||
|
||||
CHECK(etl::le_uint_t(0x012345678U) == etl::le_uint_t(0x012345678U));
|
||||
CHECK(unsigned int(0x012345678U) == etl::le_uint_t(0x012345678U));
|
||||
CHECK(etl::le_uint_t(0x012345678U) == unsigned int(0x012345678U));
|
||||
CHECK((unsigned int)(0x012345678U) == etl::le_uint_t(0x012345678U));
|
||||
CHECK(etl::le_uint_t(0x012345678U) == (unsigned int)(0x012345678U));
|
||||
|
||||
if (sizeof(long) == 4U)
|
||||
{
|
||||
@ -214,20 +214,20 @@ namespace
|
||||
CHECK(etl::le_long_t(0x012345678) == long(0x012345678));
|
||||
|
||||
CHECK(etl::le_ulong_t(0x012345678U) == etl::le_ulong_t(0x012345678U));
|
||||
CHECK(unsigned long(0x012345678U) == etl::le_ulong_t(0x012345678U));
|
||||
CHECK(etl::le_ulong_t(0x012345678U) == unsigned long(0x012345678U));
|
||||
CHECK((unsigned long)(0x012345678U) == etl::le_ulong_t(0x012345678U));
|
||||
CHECK(etl::le_ulong_t(0x012345678U) == (unsigned long)(0x012345678U));
|
||||
}
|
||||
|
||||
if (sizeof(long long) == 8U)
|
||||
{
|
||||
// long long
|
||||
CHECK(etl::le_long_long_t(0x0123456789ABCDEF) == etl::le_long_long_t(0x0123456789ABCDEF));
|
||||
CHECK(long long(0x0123456789ABCDEF) == etl::le_long_long_t(0x0123456789ABCDEF));
|
||||
CHECK(etl::le_long_long_t(0x0123456789ABCDEF) == long long(0x0123456789ABCDEF));
|
||||
CHECK((long long)(0x0123456789ABCDEF) == etl::le_long_long_t(0x0123456789ABCDEF));
|
||||
CHECK(etl::le_long_long_t(0x0123456789ABCDEF) == (long long)(0x0123456789ABCDEF));
|
||||
|
||||
CHECK(etl::le_ulong_long_t(0x0123456789ABCDEFU) == etl::le_ulong_long_t(0x0123456789ABCDEFU));
|
||||
CHECK(unsigned long long(0x0123456789ABCDEFU) == etl::le_ulong_long_t(0x0123456789ABCDEFU));
|
||||
CHECK(etl::le_ulong_long_t(0x0123456789ABCDEFU) == unsigned long long(0x0123456789ABCDEFU));
|
||||
CHECK((unsigned long long)(0x0123456789ABCDEFU) == etl::le_ulong_long_t(0x0123456789ABCDEFU));
|
||||
CHECK(etl::le_ulong_long_t(0x0123456789ABCDEFU) == (unsigned long long)(0x0123456789ABCDEFU));
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,12 +240,12 @@ namespace
|
||||
CHECK(etl::le_char_t(0x01) != char(0x02));
|
||||
|
||||
CHECK(etl::le_schar_t(0x01) != etl::le_schar_t(0x02));
|
||||
CHECK(signed char(0x01) != etl::le_schar_t(0x02));
|
||||
CHECK(etl::le_schar_t(0x01) != signed char(0x02));
|
||||
CHECK((signed char)(0x01) != etl::le_schar_t(0x02));
|
||||
CHECK(etl::le_schar_t(0x01) != (signed char)(0x02));
|
||||
|
||||
CHECK(etl::le_uchar_t(0x01U) != etl::le_uchar_t(0x02U));
|
||||
CHECK(unsigned char(0x01U) != etl::le_uchar_t(0x02U));
|
||||
CHECK(etl::le_uchar_t(0x01U) != unsigned char(0x02U));
|
||||
CHECK((unsigned char)(0x01U) != etl::le_uchar_t(0x02U));
|
||||
CHECK(etl::le_uchar_t(0x01U) != (unsigned char)(0x02U));
|
||||
|
||||
// short
|
||||
CHECK(etl::le_short_t(0x0123) != etl::le_short_t(0x0223));
|
||||
@ -253,8 +253,8 @@ namespace
|
||||
CHECK(etl::le_short_t(0x0123) != short(0x0223));
|
||||
|
||||
CHECK(etl::le_ushort_t(0x0123) != etl::le_ushort_t(0x0223));
|
||||
CHECK(unsigned short(0x0123) != etl::le_ushort_t(0x0223));
|
||||
CHECK(etl::le_ushort_t(0x0123) != unsigned short(0x0223));
|
||||
CHECK((unsigned short)(0x0123) != etl::le_ushort_t(0x0223));
|
||||
CHECK(etl::le_ushort_t(0x0123) != (unsigned short)(0x0223));
|
||||
|
||||
// int
|
||||
CHECK(etl::le_int_t(0x012345678) != etl::le_int_t(0x022345678));
|
||||
@ -262,8 +262,8 @@ namespace
|
||||
CHECK(etl::le_int_t(0x012345678) != int(0x022345678));
|
||||
|
||||
CHECK(etl::le_uint_t(0x012345678U) != etl::le_uint_t(0x022345678U));
|
||||
CHECK(unsigned int(0x012345678U) != etl::le_uint_t(0x022345678U));
|
||||
CHECK(etl::le_uint_t(0x012345678U) != unsigned int(0x022345678U));
|
||||
CHECK((unsigned int)(0x012345678U) != etl::le_uint_t(0x022345678U));
|
||||
CHECK(etl::le_uint_t(0x012345678U) != (unsigned int)(0x022345678U));
|
||||
|
||||
if (sizeof(long) == 4U)
|
||||
{
|
||||
@ -273,20 +273,20 @@ namespace
|
||||
CHECK(etl::le_long_t(0x012345678) != long(0x022345678));
|
||||
|
||||
CHECK(etl::le_ulong_t(0x012345678U) != etl::le_ulong_t(0x022345678U));
|
||||
CHECK(unsigned long(0x012345678U) != etl::le_ulong_t(0x022345678U));
|
||||
CHECK(etl::le_ulong_t(0x012345678U) != unsigned long(0x022345678U));
|
||||
CHECK((unsigned long)(0x012345678U) != etl::le_ulong_t(0x022345678U));
|
||||
CHECK(etl::le_ulong_t(0x012345678U) != (unsigned long)(0x022345678U));
|
||||
}
|
||||
|
||||
if (sizeof(long long) == 8U)
|
||||
{
|
||||
// long long
|
||||
CHECK(etl::le_long_long_t(0x0123456789ABCDEF) != etl::le_long_long_t(0x0223456789ABCDEF));
|
||||
CHECK(long long(0x0123456789ABCDEF) != etl::le_long_long_t(0x0223456789ABCDEF));
|
||||
CHECK(etl::le_long_long_t(0x0123456789ABCDEF) != long long(0x0223456789ABCDEF));
|
||||
CHECK((long long)(0x0123456789ABCDEF) != etl::le_long_long_t(0x0223456789ABCDEF));
|
||||
CHECK(etl::le_long_long_t(0x0123456789ABCDEF) != (long long)(0x0223456789ABCDEF));
|
||||
|
||||
CHECK(etl::le_ulong_long_t(0x0123456789ABCDEFU) != etl::le_ulong_long_t(0x0223456789ABCDEFU));
|
||||
CHECK(unsigned long long(0x0123456789ABCDEFU) != etl::le_ulong_long_t(0x0223456789ABCDEFU));
|
||||
CHECK(etl::le_ulong_long_t(0x0123456789ABCDEFU) != unsigned long long(0x0223456789ABCDEFU));
|
||||
CHECK((unsigned long long)(0x0123456789ABCDEFU) != etl::le_ulong_long_t(0x0223456789ABCDEFU));
|
||||
CHECK(etl::le_ulong_long_t(0x0123456789ABCDEFU) != (unsigned long long)(0x0223456789ABCDEFU));
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,12 +299,12 @@ namespace
|
||||
CHECK(etl::be_char_t(0x01) == char(0x01));
|
||||
|
||||
CHECK(etl::be_schar_t(0x01) == etl::be_schar_t(0x01));
|
||||
CHECK(signed char(0x01) == etl::be_schar_t(0x01));
|
||||
CHECK(etl::be_schar_t(0x01) == signed char(0x01));
|
||||
CHECK((signed char)(0x01) == etl::be_schar_t(0x01));
|
||||
CHECK(etl::be_schar_t(0x01) == (signed char)(0x01));
|
||||
|
||||
CHECK(etl::be_uchar_t(0x01U) == etl::be_uchar_t(0x01U));
|
||||
CHECK(unsigned char(0x01U) == etl::be_uchar_t(0x01U));
|
||||
CHECK(etl::be_uchar_t(0x01U) == unsigned char(0x01U));
|
||||
CHECK((unsigned char)(0x01U) == etl::be_uchar_t(0x01U));
|
||||
CHECK(etl::be_uchar_t(0x01U) == (unsigned char)(0x01U));
|
||||
|
||||
// short
|
||||
CHECK(etl::be_short_t(0x0123) == etl::be_short_t(0x0123));
|
||||
@ -312,8 +312,8 @@ namespace
|
||||
CHECK(etl::be_short_t(0x0123) == short(0x0123));
|
||||
|
||||
CHECK(etl::be_ushort_t(0x0123) == etl::be_ushort_t(0x0123));
|
||||
CHECK(unsigned short(0x0123) == etl::be_ushort_t(0x0123));
|
||||
CHECK(etl::be_ushort_t(0x0123) == unsigned short(0x0123));
|
||||
CHECK((unsigned short)(0x0123) == etl::be_ushort_t(0x0123));
|
||||
CHECK(etl::be_ushort_t(0x0123) == (unsigned short)(0x0123));
|
||||
|
||||
// int
|
||||
CHECK(etl::be_int_t(0x012345678) == etl::be_int_t(0x012345678));
|
||||
@ -321,8 +321,8 @@ namespace
|
||||
CHECK(etl::be_int_t(0x012345678) == int(0x012345678));
|
||||
|
||||
CHECK(etl::be_uint_t(0x012345678U) == etl::be_uint_t(0x012345678U));
|
||||
CHECK(unsigned int(0x012345678U) == etl::be_uint_t(0x012345678U));
|
||||
CHECK(etl::be_uint_t(0x012345678U) == unsigned int(0x012345678U));
|
||||
CHECK((unsigned int)(0x012345678U) == etl::be_uint_t(0x012345678U));
|
||||
CHECK(etl::be_uint_t(0x012345678U) == (unsigned int)(0x012345678U));
|
||||
|
||||
if (sizeof(long) == 4U)
|
||||
{
|
||||
@ -332,20 +332,20 @@ namespace
|
||||
CHECK(etl::be_long_t(0x012345678) == long(0x012345678));
|
||||
|
||||
CHECK(etl::be_ulong_t(0x012345678U) == etl::be_ulong_t(0x012345678U));
|
||||
CHECK(unsigned long(0x012345678U) == etl::be_ulong_t(0x012345678U));
|
||||
CHECK(etl::be_ulong_t(0x012345678U) == unsigned long(0x012345678U));
|
||||
CHECK((unsigned long)(0x012345678U) == etl::be_ulong_t(0x012345678U));
|
||||
CHECK(etl::be_ulong_t(0x012345678U) == (unsigned long)(0x012345678U));
|
||||
}
|
||||
|
||||
if (sizeof(long long) == 8U)
|
||||
{
|
||||
// long long
|
||||
CHECK(etl::be_long_long_t(0x0123456789ABCDEF) == etl::be_long_long_t(0x0123456789ABCDEF));
|
||||
CHECK(long long(0x0123456789ABCDEF) == etl::be_long_long_t(0x0123456789ABCDEF));
|
||||
CHECK(etl::be_long_long_t(0x0123456789ABCDEF) == long long(0x0123456789ABCDEF));
|
||||
CHECK((long long)(0x0123456789ABCDEF) == etl::be_long_long_t(0x0123456789ABCDEF));
|
||||
CHECK(etl::be_long_long_t(0x0123456789ABCDEF) == (long long)(0x0123456789ABCDEF));
|
||||
|
||||
CHECK(etl::be_ulong_long_t(0x0123456789ABCDEFU) == etl::be_ulong_long_t(0x0123456789ABCDEFU));
|
||||
CHECK(unsigned long long(0x0123456789ABCDEFU) == etl::be_ulong_long_t(0x0123456789ABCDEFU));
|
||||
CHECK(etl::be_ulong_long_t(0x0123456789ABCDEFU) == unsigned long long(0x0123456789ABCDEFU));
|
||||
CHECK((unsigned long long)(0x0123456789ABCDEFU) == etl::be_ulong_long_t(0x0123456789ABCDEFU));
|
||||
CHECK(etl::be_ulong_long_t(0x0123456789ABCDEFU) == (unsigned long long)(0x0123456789ABCDEFU));
|
||||
}
|
||||
}
|
||||
|
||||
@ -358,12 +358,12 @@ namespace
|
||||
CHECK(etl::be_char_t(0x01) != char(0x02));
|
||||
|
||||
CHECK(etl::be_schar_t(0x01) != etl::be_schar_t(0x02));
|
||||
CHECK(signed char(0x01) != etl::be_schar_t(0x02));
|
||||
CHECK(etl::be_schar_t(0x01) != signed char(0x02));
|
||||
CHECK((signed char)(0x01) != etl::be_schar_t(0x02));
|
||||
CHECK(etl::be_schar_t(0x01) != (signed char)(0x02));
|
||||
|
||||
CHECK(etl::be_uchar_t(0x01U) != etl::be_uchar_t(0x02U));
|
||||
CHECK(unsigned char(0x01U) != etl::be_uchar_t(0x02U));
|
||||
CHECK(etl::be_uchar_t(0x01U) != unsigned char(0x02U));
|
||||
CHECK((unsigned char)(0x01U) != etl::be_uchar_t(0x02U));
|
||||
CHECK(etl::be_uchar_t(0x01U) != (unsigned char)(0x02U));
|
||||
|
||||
// short
|
||||
CHECK(etl::be_short_t(0x0123) != etl::be_short_t(0x0223));
|
||||
@ -371,8 +371,8 @@ namespace
|
||||
CHECK(etl::be_short_t(0x0123) != short(0x0223));
|
||||
|
||||
CHECK(etl::be_ushort_t(0x0123) != etl::be_ushort_t(0x0223));
|
||||
CHECK(unsigned short(0x0123) != etl::be_ushort_t(0x0223));
|
||||
CHECK(etl::be_ushort_t(0x0123) != unsigned short(0x0223));
|
||||
CHECK((unsigned short)(0x0123) != etl::be_ushort_t(0x0223));
|
||||
CHECK(etl::be_ushort_t(0x0123) != (unsigned short)(0x0223));
|
||||
|
||||
// int
|
||||
CHECK(etl::be_int_t(0x012345678) != etl::be_int_t(0x022345678));
|
||||
@ -380,8 +380,8 @@ namespace
|
||||
CHECK(etl::be_int_t(0x012345678) != int(0x022345678));
|
||||
|
||||
CHECK(etl::be_uint_t(0x012345678U) != etl::be_uint_t(0x022345678U));
|
||||
CHECK(unsigned int(0x012345678U) != etl::be_uint_t(0x022345678U));
|
||||
CHECK(etl::be_uint_t(0x012345678U) != unsigned int(0x022345678U));
|
||||
CHECK((unsigned int)(0x012345678U) != etl::be_uint_t(0x022345678U));
|
||||
CHECK(etl::be_uint_t(0x012345678U) != (unsigned int)(0x022345678U));
|
||||
|
||||
if (sizeof(long) == 4U)
|
||||
{
|
||||
@ -391,20 +391,20 @@ namespace
|
||||
CHECK(etl::be_long_t(0x012345678) != long(0x022345678));
|
||||
|
||||
CHECK(etl::be_ulong_t(0x012345678U) != etl::be_ulong_t(0x022345678U));
|
||||
CHECK(unsigned long(0x012345678U) != etl::be_ulong_t(0x022345678U));
|
||||
CHECK(etl::be_ulong_t(0x012345678U) != unsigned long(0x022345678U));
|
||||
CHECK((unsigned long)(0x012345678U) != etl::be_ulong_t(0x022345678U));
|
||||
CHECK(etl::be_ulong_t(0x012345678U) != (unsigned long)(0x022345678U));
|
||||
}
|
||||
|
||||
if (sizeof(long long) == 8U)
|
||||
{
|
||||
// long long
|
||||
CHECK(etl::be_long_long_t(0x0123456789ABCDEF) != etl::be_long_long_t(0x0223456789ABCDEF));
|
||||
CHECK(long long(0x0123456789ABCDEF) != etl::be_long_long_t(0x0223456789ABCDEF));
|
||||
CHECK(etl::be_long_long_t(0x0123456789ABCDEF) != long long(0x0223456789ABCDEF));
|
||||
CHECK((long long)(0x0123456789ABCDEF) != etl::be_long_long_t(0x0223456789ABCDEF));
|
||||
CHECK(etl::be_long_long_t(0x0123456789ABCDEF) != (long long)(0x0223456789ABCDEF));
|
||||
|
||||
CHECK(etl::be_ulong_long_t(0x0123456789ABCDEFU) != etl::be_ulong_long_t(0x0223456789ABCDEFU));
|
||||
CHECK(unsigned long long(0x0123456789ABCDEFU) != etl::be_ulong_long_t(0x0223456789ABCDEFU));
|
||||
CHECK(etl::be_ulong_long_t(0x0123456789ABCDEFU) != unsigned long long(0x0223456789ABCDEFU));
|
||||
CHECK((unsigned long long)(0x0123456789ABCDEFU) != etl::be_ulong_long_t(0x0223456789ABCDEFU));
|
||||
CHECK(etl::be_ulong_long_t(0x0123456789ABCDEFU) != (unsigned long long)(0x0223456789ABCDEFU));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -881,7 +881,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_CPP20_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
|
||||
<UndefinePreprocessorDefinitions>
|
||||
</UndefinePreprocessorDefinitions>
|
||||
@ -903,7 +903,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_CPP20_ENABLED;ETL_NO_STL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_NO_STL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
|
||||
<UndefinePreprocessorDefinitions>
|
||||
</UndefinePreprocessorDefinitions>
|
||||
@ -1184,7 +1184,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;__clang__;ETL_CPP20_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;__clang__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
|
||||
<UndefinePreprocessorDefinitions>
|
||||
</UndefinePreprocessorDefinitions>
|
||||
@ -9457,6 +9457,8 @@
|
||||
<ClCompile Include="..\test_state_chart.cpp" />
|
||||
<ClCompile Include="..\test_smallest.cpp" />
|
||||
<ClCompile Include="..\test_stack.cpp" />
|
||||
<ClCompile Include="..\test_state_chart_compile_time.cpp" />
|
||||
<ClCompile Include="..\test_state_chart_compile_time_with_data_parameter.cpp" />
|
||||
<ClCompile Include="..\test_state_chart_with_data_parameter.cpp" />
|
||||
<ClCompile Include="..\test_state_chart_with_rvalue_data_parameter.cpp" />
|
||||
<ClCompile Include="..\test_string_utilities_std.cpp" />
|
||||
@ -9522,6 +9524,7 @@
|
||||
<None Include="..\..\.gitmodules" />
|
||||
<None Include="..\..\appveyor.yml" />
|
||||
<None Include="..\..\arduino\create_arduino_library.py" />
|
||||
<None Include="..\..\arduino\library.properties" />
|
||||
<None Include="..\..\etl.pspimage" />
|
||||
<None Include="..\..\etl.xar" />
|
||||
<None Include="..\..\include\etl\generators\generate.bat" />
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user