2#include "../../../tests/catch2/catch.hpp"
4#include <mx/sys/timeUtils.hpp>
6#include "../stateCodes.hpp"
11SCENARIO(
"Getting State Strings From Codes",
"[stateCodes]" )
13 GIVEN(
"a valid state code")
18 REQUIRE(str ==
"FAILURE");
21 REQUIRE(str ==
"ERROR");
24 REQUIRE(str ==
"UNINITIALIZED");
27 REQUIRE(str ==
"INITIALIZED");
30 REQUIRE(str ==
"NODEVICE");
33 REQUIRE(str ==
"POWEROFF");
36 REQUIRE(str ==
"POWERON");
39 REQUIRE(str ==
"NOTCONNECTED");
42 REQUIRE(str ==
"CONNECTED");
45 REQUIRE(str ==
"LOGGEDIN");
48 REQUIRE(str ==
"CONFIGURING");
51 REQUIRE(str ==
"NOTHOMED");
54 REQUIRE(str ==
"HOMING");
57 REQUIRE(str ==
"OPERATING");
60 REQUIRE(str ==
"READY");
63 REQUIRE(str ==
"SHUTDOWN");
66 REQUIRE(str ==
"UNKNOWN");
70SCENARIO(
"Getting State Codes From Strings",
"[stateCodes]" )
72 GIVEN(
"a string using stateCodeFast")
128 WHEN(
"strings too short")
155 WHEN(
"invalid strings")
173 GIVEN(
"a string using stateCode")
175 WHEN(
"valid strings")
229 WHEN(
"invalid strings")
SCENARIO("Getting State Strings From Codes", "[stateCodes]")
@ OPERATING
The device is operating, other than homing.
@ POWEROFF
The device power is off.
@ NODEVICE
No device exists for the application to control.
@ SHUTDOWN
The application has shutdown, set just after calling appShutdown().
@ NOTHOMED
The device has not been homed.
@ HOMING
The device is homing.
@ FAILURE
The application has failed, should be used when m_shutdown is set for an error.
@ CONFIGURING
The application is configuring the device.
@ ERROR
The application has encountered an error, from which it is recovering (with or without intervention)
@ READY
The device is ready for operation, but is not operating.
@ LOGGEDIN
The application has logged into the device or service.
@ CONNECTED
The application has connected to the device or service.
@ UNINITIALIZED
The application is unitialized, the default.
@ INITIALIZED
The application has been initialized, set just before calling appStartup().
@ NOTCONNECTED
The application is not connected to the device or service.
@ POWERON
The device power is on.
static stateCodeT str2CodeFast(const std::string &stateStr)
Get the stateCode corresponding to an ASCII string with minimal checks.
int16_t stateCodeT
The type of the state code.
static stateCodeT str2Code(const std::string &stateStr)
Get the stateCode corresponding to an ASCII string.
static std::string codeText(const stateCodeT &stateCode)
Get an ASCII string corresponding to an application stateCode.