Skip to content

Commit

Permalink
FPP v2.3.0a1 (#3066)
Browse files Browse the repository at this point in the history
* Update requirements to use new fpp version

* Removed unneeded files

* update FppTest for new autocoder changes

* Get unit tests updated and working for fpp state machines phase 1 delivery

* Rename Fw/SMTest to Fw/Sm

* Update STARS to use FW_ASSERT

* Rename SMSignalBuffer to SmSignalBuffer

* Fix spelling issues with CI

* Update requirements to the FPP alpha release v2.2.0a3

* Fix requirements.txt

* Fix requirements.txt

* Initialize data in the constructor of SmSignalBuffer

* Add constructor list to all the constructors in SmSignalBuffer

* Reorganize FppTest directories

Move external state machine tests to state_machine/external

* Add missing file

* Reorganize FppTest/state_machine

external --> external_instance

* Add state machine test harness

* Revise SmGuard

* Fix include guard

* Add header file for test harness

* Revise Basic state machine

* Revise Basic test

* Add Junction test

* Add missing file

* Refactor internal state machine tests

* Add Nested state machine

* Revise Nested test

* Revise state machine tests

* Fix issues in string utils

* Revise FppTest

Add signals to state machine tests

* Refactor state machine test harness

* Revise autocode for Basic test

Replace with actual autocode

* Update fpp version

Fix F Prime to match
Switch initial/basic test from checked-in to auto-generated

* Revise FppTest

Make state machine guards const

* Update fpp version

Convert initial/Junction test to autocode

* Update fpp version

Make initial/nested test use autocode

* Start to add State/Basic test

* Revise FppTest

Revise namespaces in state machine tests

* Revise SmState::Basic test

* Update fpp version

Convert SmState/Basic test to use autocoding

* Update FppTest

* Add SmState/BasicSelf test

* Add state/BasicGuard test

* Add SmState/BasicU32 test

* Revise state machine tests

* Refactor state machine tests

* Revise FppTest

* Revise comments

* Refactor state machine tests

* Refactor state machine tests

* Refactor state machine tests

* Refactor state machine tests

* Revise state machine tests

* Revise state machine tests

* Revise state machine tests

* Revise state machine tests

* Revise fpp tests

* Revise state machine tests

* Revise state machine tests

* Revise state machine tests

* Revise state machine tests

* Revise state machine tests

* Add README files to FPP tests

* Start to add StateToState test

* Revise StateToState test

* Revise StateToState test

* Revise StateToState test

* Revise StateToState test

* Revise StateToState test

Remove hand-generated files

* Revise StateToState tests

* Add BasicInternal test

* Update fpp version

* Revise state machine tests

* Add state-to-junction test

* Add Internal state machine test

* Add Polymorphism test

* Add StateToChild test

* Revise README files

* Add junction/Basic test

* Revise FppTest build

* Update fpp version; revise Basic test

* Revise junction tests

* Add BasicGuardU32 test

* Add BasicGuardString test

* Add BasicGuardTestAbsType test

* Add BasicGuardTestArray test

* Add BasicGuardTestEnum test

* Add BasicGuardTestStruct test

* Add junction/Sequence test

* Add junction/SequenceU32 test

* Add junction/InputPairU16U32 test

* Add JunctionToState.fpp

* Add junction/JunctionToState test

* Add junction/JunctionToJunction test

* Update fpp version

* Update fpp version

Revise test code to match

* Update fpp version

* Update fpp version

* Fix CMakeLists

* Update fpp version

* Update fpp version

* Refactor sm tests

* Refactor sm tests

* Refactor sm tests

* Update fpp version

* Start to add internal_instance tests

* Add missing files

* Revise state machine tests

* Revise state machine tests

* Revise sm instance initial tests

* Revise sm instance init tests

* Revise sm instance initial tests

* Revise sm instance initial tests

* Add sm instance state tests

* Revise sm instance state tests

* Revise sm instance state tests

* Revise sm instance state tests

* Revise sm instance state tests

* Revise internal instance state tests

* Revise sm instance state tests

* Revise sm instance state tests

* Revsie BasicGuardTestAbsType

* Revise sm instance state tests

* Revise BasicGuardTestAbsType

* Add BasicGuardTestArray

* Add BasicGuardTestEnum

* Add BasicGuardTestStruct

* Add BasicGuardU32

* Add BasicInternal

* Revise BasicInternal

* Add BasicSelf

* Reformat code

* Add BasicString test

* Add BasicTestAbsType

* Add BasicTestArray

* Add BasicTestEnum

* Add BasicTestStruct

* Add BasicU32

* Remove extraneous file

* Remove extraneous files

* Revise sm tests

* Revise state machine tests

* Add Internal test

* Add Polymorphism test

* Add StateToChild test

* Add StateToJunction test

* Add StateToSelf test

* Add StateToState test

* Add junction/Basic

* Add BasicU32 test

* Add InputPairU16U32

* Add JunctionToJunction

* Revise comments

* Add JunctionToState

* Revise JunctionToState

* Revise JunctionToJunction

* Add Sequence test

* Add Sequence test

* Revise SequenceU32 test

* Revise state machine tests

Add tests for queued components

* Revise Basic test

Add schedIn handler

* Revise junction/Basic test

Add schedIn handler

* Revise state/Basic test

Add schedIn handler

* Revise initial/Basic test

Add multiple instances of the same state machine

* Revise state/Basic test

Add multiple instances of the same state machine

* Reformat code

* Update fpp version

* Update fpp; revise FppTest

* Refactor internal/initial tests

* Revise state machine tests

* Revise internal/state tests

* Revise state-machine/internal tests

Rename junction to choice

* Revise state-machine/internal tests

* Reformat C++ files

* Revise state-machine/internal_instance/initial tests

* Revise internal_instance/state tests

* Format code

* Revise internal_instance/choice tests

* Update fpp version

* Format code

* Update fpp version

* Improve const correctness in Fw/Port

* Update design

* Revise state machines design

* Revise state machine design

* Revise state machine design

* Revise state machine design

* Revise state machine design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machine instances design

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Update fpp version

* Update fpp version; revise code to match

* Update fpp version

* Revise state machines design

* Revise state machines design

Add class diagram

* Revise state machines design

* Revise state machines design

* Revise typography

Close up spaces in names with embedded variables

* Revise state machines design

* Revise state machines design

* Revise state machines design

* Revise state machine unit tests

* Revise state machine tests

Increase code coverage

* Revise state machine tests

Increase code coverage

* Update fpp version

* Update spelling

* Remove Design directory

This directory no longer exists in fprime/devel

* Update mkdocs

---------

Co-authored-by: watney <[email protected]>
Co-authored-by: garthwatney <[email protected]>
Co-authored-by: M Starch <[email protected]>
  • Loading branch information
4 people authored Jan 6, 2025
1 parent 037b199 commit 02a351c
Show file tree
Hide file tree
Showing 288 changed files with 16,413 additions and 62 deletions.
3 changes: 3 additions & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ argname
argtype
arinc
arpa
ASize
ASTRING
ATester
ATL
Expand Down Expand Up @@ -103,6 +104,7 @@ carg
caselessmatch
CBF
CBLOCK
CComponent
CCSDS
ccsparc
cdefs
Expand Down Expand Up @@ -566,6 +568,7 @@ mscfile
mseconds
mstarch
mstat
MState
mstring
mtype
multiarch
Expand Down
16 changes: 11 additions & 5 deletions FppTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/struct/")
set(SOURCE_FILES "source.cpp")
set(MOD_DEPS
${PROJECT_NAME}/array
${PROJECT_NAME}/component/active
${PROJECT_NAME}/component/empty
${PROJECT_NAME}/component/passive
${PROJECT_NAME}/component/queued
${PROJECT_NAME}/dp
${PROJECT_NAME}/state_machine
${PROJECT_NAME}/enum
${PROJECT_NAME}/state_machine/external_instance
${PROJECT_NAME}/state_machine/internal/initial
${PROJECT_NAME}/state_machine/internal/junction
${PROJECT_NAME}/state_machine/internal/state
${PROJECT_NAME}/state_machine/internal_instance/initial
${PROJECT_NAME}/state_machine/internal_instance/junction
${PROJECT_NAME}/state_machine/internal_instance/state
${PROJECT_NAME}/struct
${PROJECT_NAME}/component/empty
${PROJECT_NAME}/component/active
${PROJECT_NAME}/component/queued
${PROJECT_NAME}/component/passive
)

register_fprime_deployment()
24 changes: 3 additions & 21 deletions FppTest/state_machine/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
set(SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/SmTest.cpp"
"${CMAKE_CURRENT_LIST_DIR}/SmTest.fpp"
"${CMAKE_CURRENT_LIST_DIR}/DeviceSm.cpp"
"${CMAKE_CURRENT_LIST_DIR}/HackSm.cpp"
)
set(MOD_DEPS Fw/Sm)

register_fprime_module()

set(UT_SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/SmTest.fpp"
"${CMAKE_CURRENT_LIST_DIR}/test/ut/SmTestTestMain.cpp"
"${CMAKE_CURRENT_LIST_DIR}/test/ut/SmTestTester.cpp"
"${CMAKE_CURRENT_LIST_DIR}/DeviceSm.cpp"
"${CMAKE_CURRENT_LIST_DIR}/HackSm.cpp"
)

set(UT_MOD_DEPS STest)
set(UT_AUTO_HELPERS ON)
register_fprime_ut()
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/external_instance/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/internal/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/internal_instance/")
3 changes: 3 additions & 0 deletions FppTest/state_machine/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# state_machine

Tests for FPP state machines.
20 changes: 20 additions & 0 deletions FppTest/state_machine/external_instance/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
set(SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/SmTest.cpp"
"${CMAKE_CURRENT_LIST_DIR}/SmTest.fpp"
"${CMAKE_CURRENT_LIST_DIR}/DeviceSm.cpp"
"${CMAKE_CURRENT_LIST_DIR}/HackSm.cpp"
)
set(MOD_DEPS Fw/Sm)

register_fprime_module()

set(UT_SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/SmTest.fpp"
"${CMAKE_CURRENT_LIST_DIR}/test/ut/SmTestTestMain.cpp"
"${CMAKE_CURRENT_LIST_DIR}/test/ut/SmTestTester.cpp"
"${CMAKE_CURRENT_LIST_DIR}/DeviceSm.cpp"
"${CMAKE_CURRENT_LIST_DIR}/HackSm.cpp"
)
set(UT_MOD_DEPS STest)
set(UT_AUTO_HELPERS ON)
register_fprime_ut()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <cstdio>

#include "FppTest/state_machine/SmTest.hpp"
#include "FppTest/state_machine/external_instance/SmTest.hpp"
#include "Fw/Types/Assert.hpp"

namespace FppTest {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <array>

#include "FppTest/state_machine/SmTestComponentAc.hpp"
#include "FppTest/state_machine/external_instance/SmTestComponentAc.hpp"
#include "Fw/Types/String.hpp"

namespace FppTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SmTestTestMain.cpp
// ----------------------------------------------------------------------

#include "FppTest/state_machine/test/ut/SmTestTester.hpp"
#include "FppTest/state_machine/external_instance/test/ut/SmTestTester.hpp"
#include "Fw/Test/UnitTest.hpp"
#include "STest/Random/Random.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <cstring>

#include "FppTest/state_machine/test/ut/SmTestTester.hpp"
#include "FppTest/state_machine/external_instance/test/ut/SmTestTester.hpp"
#include "Fw/Types/ExternalString.hpp"
#include "STest/Pick/Pick.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define FppTest_SmTest_Tester_HPP

#include "SmTestGTestBase.hpp"
#include "FppTest/state_machine/SmTest.hpp"
#include "FppTest/state_machine/external_instance/SmTest.hpp"
#include "STest/Pick/Pick.hpp"

namespace FppTest {
Expand Down
4 changes: 4 additions & 0 deletions FppTest/state_machine/internal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/choice/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/harness/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/initial/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/state/")
4 changes: 4 additions & 0 deletions FppTest/state_machine/internal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# state_machine/internal

Tests for internal FPP state machines, i.e., state machines whose behavior
is expressed in FPP.
82 changes: 82 additions & 0 deletions FppTest/state_machine/internal/choice/Basic.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// ======================================================================
//
// \title Basic.hpp
// \author R. Bocchino
// \brief Test class for basic state machine with a choice (implementation)
//
// \copyright
// Copyright 2024, by the California Institute of Technology.
// ALL RIGHTS RESERVED. United States Government Sponsorship
// acknowledged.
//
// ======================================================================

#include <gtest/gtest.h>

#include "FppTest/state_machine/internal/choice/Basic.hpp"
#include "STest/STest/Pick/Pick.hpp"

namespace FppTest {

namespace SmChoice {

Basic::Basic() : BasicStateMachineBase(), m_action_a_history(), m_action_b_history(), m_guard_g() {}

void Basic::action_a(Signal signal) {
this->m_action_a_history.push(signal);
}

void Basic::action_b(Signal signal) {
this->m_action_b_history.push(signal);
}

bool Basic::guard_g(Signal signal) const {
return this->m_guard_g.call(signal);
}

void Basic::testTrue() {
this->m_action_a_history.clear();
this->m_action_b_history.clear();
this->m_guard_g.reset();
this->m_guard_g.setReturnValue(true);
const FwEnumStoreType id = SmHarness::Pick::stateMachineId();
this->initBase(id);
ASSERT_EQ(this->m_id, id);
ASSERT_EQ(this->getState(), State::S1);
ASSERT_EQ(this->m_guard_g.getCallHistory().getSize(), 0);
ASSERT_EQ(this->m_action_a_history.getSize(), 0);
ASSERT_EQ(this->m_action_b_history.getSize(), 0);
this->sendSignal_s();
this->sendSignal_s();
ASSERT_EQ(this->m_guard_g.getCallHistory().getSize(), 1);
ASSERT_EQ(this->m_guard_g.getCallHistory().getItemAt(0), Signal::s);
ASSERT_EQ(this->m_action_a_history.getSize(), 1);
ASSERT_EQ(this->m_action_a_history.getItemAt(0), Signal::s);
ASSERT_EQ(this->m_action_b_history.getSize(), 0);
ASSERT_EQ(this->getState(), State::S2);
}

void Basic::testFalse() {
this->m_action_a_history.clear();
this->m_action_b_history.clear();
this->m_guard_g.reset();
const FwEnumStoreType id = SmHarness::Pick::stateMachineId();
this->initBase(id);
ASSERT_EQ(this->m_id, id);
ASSERT_EQ(this->getState(), State::S1);
ASSERT_EQ(this->m_guard_g.getCallHistory().getSize(), 0);
ASSERT_EQ(this->m_action_a_history.getSize(), 0);
ASSERT_EQ(this->m_action_b_history.getSize(), 0);
this->sendSignal_s();
this->sendSignal_s();
ASSERT_EQ(this->m_guard_g.getCallHistory().getSize(), 1);
ASSERT_EQ(this->m_guard_g.getCallHistory().getItemAt(0), Signal::s);
ASSERT_EQ(this->m_action_a_history.getSize(), 0);
ASSERT_EQ(this->m_action_b_history.getSize(), 1);
ASSERT_EQ(this->m_action_b_history.getItemAt(0), Signal::s);
ASSERT_EQ(this->getState(), State::S3);
}

} // namespace SmChoice

} // end namespace FppTest
9 changes: 9 additions & 0 deletions FppTest/state_machine/internal/choice/Basic.fpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module FppTest {

module SmChoice {

include "include/Basic.fppi"

}

}
69 changes: 69 additions & 0 deletions FppTest/state_machine/internal/choice/Basic.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// ======================================================================
//
// \title Basic.hpp
// \author R. Bocchino
// \brief Test class for basic state machine with a choice (header)
//
// \copyright
// Copyright 2024, by the California Institute of Technology.
// ALL RIGHTS RESERVED. United States Government Sponsorship
// acknowledged.
//
// ======================================================================

#ifndef FppTest_State_Basic_HPP
#define FppTest_State_Basic_HPP

#include "FppTest/state_machine/internal/choice/BasicStateMachineAc.hpp"
#include "FppTest/state_machine/internal/harness/Harness.hpp"

namespace FppTest {

namespace SmChoice {

//! A basic state machine with a choice
class Basic final : public BasicStateMachineBase {
public:
//! The history size
static constexpr FwSizeType historySize = 10;

public:
//! Constructor
Basic();

private:
//! Implementation of action a
void action_a(Signal signal //!< The signal
) final;

//! Implementation of action b
void action_b(Signal signal //!< The signal
) final;

//! Implementation of guard g
bool guard_g(Signal signal //!< The signal
) const final;

public:
//! Run the test with the true guard
void testTrue();

//! Run the test with the false guard
void testFalse();

private:
//! The history associated with action a
SmHarness::History<Signal, historySize> m_action_a_history;

//! The history associated with action b of Basic
SmHarness::History<Signal, historySize> m_action_b_history;

//! The guard g
SmHarness::NoArgGuard<Signal, historySize> m_guard_g;
};

} // namespace SmChoice

} // end namespace FppTest

#endif
Loading

0 comments on commit 02a351c

Please sign in to comment.