From 726b434e7fa8b29037d91685d9757eba0c5d467a Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 18:16:19 -0800 Subject: [PATCH 01/30] Revise FppTest --- FppTestProject/FppTest/array/CMakeLists.txt | 1 + FppTestProject/FppTest/array/main.cpp | 70 +++++++++++++++------ requirements.txt | 2 +- 3 files changed, 53 insertions(+), 20 deletions(-) diff --git a/FppTestProject/FppTest/array/CMakeLists.txt b/FppTestProject/FppTest/array/CMakeLists.txt index c21bd16343b..e777e3853cc 100644 --- a/FppTestProject/FppTest/array/CMakeLists.txt +++ b/FppTestProject/FppTest/array/CMakeLists.txt @@ -8,6 +8,7 @@ set(SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/alias.fpp" "${CMAKE_CURRENT_LIST_DIR}/array.fpp" "${CMAKE_CURRENT_LIST_DIR}/enum.fpp" + "${CMAKE_CURRENT_LIST_DIR}/state_machine.fpp" "${CMAKE_CURRENT_LIST_DIR}/string.fpp" "${CMAKE_CURRENT_LIST_DIR}/struct.fpp" "${CMAKE_CURRENT_LIST_DIR}/format.fpp" diff --git a/FppTestProject/FppTest/array/main.cpp b/FppTestProject/FppTest/array/main.cpp index 028c56bd48a..864a36079bc 100644 --- a/FppTestProject/FppTest/array/main.cpp +++ b/FppTestProject/FppTest/array/main.cpp @@ -13,6 +13,7 @@ #include "FppTest/array/AliasOfArrayAliasAc.hpp" #include "FppTest/array/AliasStringArrayAc.hpp" #include "FppTest/array/EnumArrayAc.hpp" +#include "FppTest/array/SM_AArrayAc.hpp" #include "FppTest/array/StringArrayAc.hpp" #include "FppTest/array/StructArrayAc.hpp" #include "FppTest/array/Uint32ArrayArrayAc.hpp" @@ -25,10 +26,13 @@ #include "gtest/gtest.h" // Instantiate array tests -using ArrayTestImplementations = ::testing::Types; +using ArrayTestImplementations = ::testing::Types; INSTANTIATE_TYPED_TEST_SUITE_P(FppTest, ArrayTest, ArrayTestImplementations); +// ---------------------------------------------------------------------- // Specializations for default values +// ---------------------------------------------------------------------- + template <> void FppTest::Array::setDefaultVals(E (&a)[Enum::SIZE]) { a[0] = E::A; @@ -36,22 +40,41 @@ void FppTest::Array::setDefaultVals(E (&a)[Enum::SIZE]) { a[2] = E::C; } -// Specialization for test values +static char stringDefaultValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE]; + template <> -void FppTest::Array::setTestVals(E (&a)[Enum::SIZE]) { - a[0] = static_cast(STest::Pick::startLength(E::B, E::NUM_CONSTANTS - 1)); +void FppTest::Array::setDefaultVals(Fw::ExternalString (&a)[::String::SIZE]) { + for (U32 i = 0; i < ::String::SIZE; i++) { + a[i].setBuffer(stringDefaultValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE); + } +} - for (U32 i = 1; i < Enum::SIZE; i++) { - a[i] = static_cast(STest::Pick::startLength(E::A, E::NUM_CONSTANTS - 1)); +static char stringAliasDefaultValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE]; + +template <> +void FppTest::Array::setDefaultVals(Fw::ExternalString (&a)[::AliasString::SIZE]) { + for (U32 i = 0; i < ::AliasString::SIZE; i++) { + a[i].setBuffer(stringAliasDefaultValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE); } } -static char stringDefaultValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE]; +template <> +void FppTest::Array::setDefaultVals(U32 (&a)[SM_A::SIZE]) { + for (U32 i = 0; i < SM_A::SIZE; i++) { + a[i] = 0; + } +} + +// ---------------------------------------------------------------------- +// Specializations for test values +// ---------------------------------------------------------------------- template <> -void FppTest::Array::setDefaultVals(Fw::ExternalString (&a)[::String::SIZE]) { - for (U32 i = 0; i < ::String::SIZE; i++) { - a[i].setBuffer(stringDefaultValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE); +void FppTest::Array::setTestVals(E (&a)[Enum::SIZE]) { + a[0] = static_cast(STest::Pick::startLength(E::B, E::NUM_CONSTANTS - 1)); + + for (U32 i = 1; i < Enum::SIZE; i++) { + a[i] = static_cast(STest::Pick::startLength(E::A, E::NUM_CONSTANTS - 1)); } } @@ -87,15 +110,6 @@ void FppTest::Array::setTestVals(Uint32 (&a)[Uint32Array::SIZE]) { } } -static char stringAliasDefaultValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE]; - -template <> -void FppTest::Array::setDefaultVals(Fw::ExternalString (&a)[::AliasString::SIZE]) { - for (U32 i = 0; i < ::AliasString::SIZE; i++) { - a[i].setBuffer(stringAliasDefaultValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE); - } -} - static char stringAliasTestValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE]; template <> @@ -115,7 +129,17 @@ void FppTest::Array::setTestVals(EA (&a)[AliasOfArray::SIZE]) { } } +template <> +void FppTest::Array::setTestVals(U32 (&a)[SM_A::SIZE]) { + for (U32 i = 1; i < SM_A::SIZE; i++) { + a[i] = STest::Pick::any(); + } +} + +// ---------------------------------------------------------------------- // Specializations for multi element constructor +// ---------------------------------------------------------------------- + template <> Enum FppTest::Array::getMultiElementConstructedArray(E (&a)[Enum::SIZE]) { return Enum({a[0], a[1], a[2]}); @@ -136,7 +160,15 @@ Uint32Array FppTest::Array::getMultiElementConstructedArray(Uint32 return Uint32Array({a[0], a[1], a[2]}); } +template <> +SM_A FppTest::Array::getMultiElementConstructedArray(U32 (&a)[SM_A::SIZE]) { + return SM_A({a[0], a[1], a[2]}); +} + +// ---------------------------------------------------------------------- // Specializations for serialized size +// ---------------------------------------------------------------------- + template <> U32 FppTest::Array::getSerializedSize<::String>(Fw::ExternalString (&a)[::String::SIZE]) { U32 serializedSize = 0; diff --git a/requirements.txt b/requirements.txt index bfdfb5af9a8..60a238c1855 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ Flask-Compress==1.15 Flask-RESTful==0.3.10 fprime-fpl-layout==1.0.3 fprime-fpl-write-pic==1.0.3 -fprime-fpp==3.1.1a1 +fprime-fpp==3.1.1a1-26-g925a23703 fprime-gds==4.1.0 fprime-tools==4.1.0 fprime-visual==1.0.2 From 1b84f07ca5c4ef6e22f88cfff27d46867836eeb0 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 21:34:35 -0800 Subject: [PATCH 02/30] Revise FppTest array tests --- .../FppTest/array/ArrayToStringTest.cpp | 3 +- FppTestProject/FppTest/array/main.cpp | 200 +++++++++++------- 2 files changed, 120 insertions(+), 83 deletions(-) diff --git a/FppTestProject/FppTest/array/ArrayToStringTest.cpp b/FppTestProject/FppTest/array/ArrayToStringTest.cpp index 0818f372b17..80aa24b668b 100644 --- a/FppTestProject/FppTest/array/ArrayToStringTest.cpp +++ b/FppTestProject/FppTest/array/ArrayToStringTest.cpp @@ -13,6 +13,7 @@ #include "FppTest/array/AliasOfArrayAliasAc.hpp" #include "FppTest/array/AliasStringArrayAc.hpp" #include "FppTest/array/EnumArrayAc.hpp" +#include "FppTest/array/SM_AArrayAc.hpp" #include "FppTest/array/StringArrayAc.hpp" #include "FppTest/array/StructArrayAc.hpp" #include "FppTest/array/Uint32ArrayArrayAc.hpp" @@ -32,7 +33,7 @@ class ArrayToStringTest : public ::testing::Test { typename ArrayType::ElementType testVals[ArrayType::SIZE]; }; -using ArrayTypes = ::testing::Types; +using ArrayTypes = ::testing::Types; TYPED_TEST_SUITE(ArrayToStringTest, ArrayTypes); // Test array toString() and ostream operator functions diff --git a/FppTestProject/FppTest/array/main.cpp b/FppTestProject/FppTest/array/main.cpp index 864a36079bc..ebded8f80d8 100644 --- a/FppTestProject/FppTest/array/main.cpp +++ b/FppTestProject/FppTest/array/main.cpp @@ -1,13 +1,7 @@ // ====================================================================== // \title main.cpp -// \author T. Chieu +// \author T. Chieu, A. Tumbar, R. Bocchino // \brief main cpp file for FPP array tests -// -// \copyright -// Copyright (C) 2009-2022 California Institute of Technology. -// ALL RIGHTS RESERVED. United States Government Sponsorship -// acknowledged. -// // ====================================================================== #include "FppTest/array/AliasOfArrayAliasAc.hpp" @@ -25,50 +19,92 @@ #include "STest/Random/Random.hpp" #include "gtest/gtest.h" -// Instantiate array tests -using ArrayTestImplementations = ::testing::Types; +// ---------------------------------------------------------------------- +// Test instatiations +// ---------------------------------------------------------------------- + +// Array tests +using ArrayTestImplementations = ::testing::Types; INSTANTIATE_TYPED_TEST_SUITE_P(FppTest, ArrayTest, ArrayTestImplementations); +// String tests +using StringTestImplementations = ::testing::Types, Fw::StringTemplate<100>>; +INSTANTIATE_TYPED_TEST_SUITE_P(Array, StringTest, StringTestImplementations); + // ---------------------------------------------------------------------- -// Specializations for default values +// Template specializations for AliasOfArray type // ---------------------------------------------------------------------- template <> -void FppTest::Array::setDefaultVals(E (&a)[Enum::SIZE]) { +void FppTest::Array::setDefaultVals(E (&a)[Enum::SIZE]) { a[0] = E::A; a[1] = E::B; a[2] = E::C; } -static char stringDefaultValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE]; +template <> +void FppTest::Array::setTestVals(EA (&a)[AliasOfArray::SIZE]) { + a[0] = static_cast(STest::Pick::startLength(EA::B, EA::NUM_CONSTANTS - 1)); + + for (U32 i = 1; i < Enum::SIZE; i++) { + a[i] = static_cast(STest::Pick::startLength(EA::A, EA::NUM_CONSTANTS - 1)); + } +} template <> -void FppTest::Array::setDefaultVals(Fw::ExternalString (&a)[::String::SIZE]) { - for (U32 i = 0; i < ::String::SIZE; i++) { - a[i].setBuffer(stringDefaultValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE); +AliasOfArray FppTest::Array::getMultiElementConstructedArray(EA (&a)[AliasOfArray::SIZE]) { + return AliasOfArray({a[0], a[1], a[2]}); +} + +template <> +U32 FppTest::Array::getSerializedSize(Fw::ExternalString (&a)[AliasString::SIZE]) { + U32 serializedSize = 0; + + for (U32 i = 0; i < AliasString::SIZE; i++) { + serializedSize += static_cast(a[i].serializedSize()); } + + return serializedSize; } -static char stringAliasDefaultValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE]; +// ---------------------------------------------------------------------- +// Template specializations for AliasString type +// ---------------------------------------------------------------------- + +static char aliasStringDefaultValsBuffer[AliasString::SIZE][AliasString::ELEMENT_BUFFER_SIZE]; +static char aliasStringTestValsBuffer[AliasString::SIZE][AliasString::ELEMENT_BUFFER_SIZE]; template <> void FppTest::Array::setDefaultVals(Fw::ExternalString (&a)[::AliasString::SIZE]) { for (U32 i = 0; i < ::AliasString::SIZE; i++) { - a[i].setBuffer(stringAliasDefaultValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE); + a[i].setBuffer(aliasStringDefaultValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE); } } template <> -void FppTest::Array::setDefaultVals(U32 (&a)[SM_A::SIZE]) { - for (U32 i = 0; i < SM_A::SIZE; i++) { - a[i] = 0; +void FppTest::Array::setTestVals(Fw::ExternalString (&a)[AliasString::SIZE]) { + for (U32 i = 0; i < ::AliasString::SIZE; i++) { + a[i].setBuffer(aliasStringTestValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE); + FppTest::Utils::setString(aliasStringTestValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE, 1); } } +template <> +AliasString FppTest::Array::getMultiElementConstructedArray(Fw::ExternalString (&a)[::String::SIZE]) { + return AliasString({Fw::String(a[0]), Fw::String(a[1]), Fw::String(a[2])}); +} + // ---------------------------------------------------------------------- -// Specializations for test values +// Template specializations for Enum type // ---------------------------------------------------------------------- +template <> +void FppTest::Array::setDefaultVals(E (&a)[Enum::SIZE]) { + a[0] = E::A; + a[1] = E::B; + a[2] = E::C; +} + template <> void FppTest::Array::setTestVals(E (&a)[Enum::SIZE]) { a[0] = static_cast(STest::Pick::startLength(E::B, E::NUM_CONSTANTS - 1)); @@ -78,71 +114,54 @@ void FppTest::Array::setTestVals(E (&a)[Enum::SIZE]) { } } -static char stringTestValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE]; - template <> -void FppTest::Array::setTestVals(Fw::ExternalString (&a)[::String::SIZE]) { - for (U32 i = 0; i < ::String::SIZE; i++) { - a[i].setBuffer(stringTestValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE); - FppTest::Utils::setString(stringTestValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE, 1); - } +Enum FppTest::Array::getMultiElementConstructedArray(E (&a)[Enum::SIZE]) { + return Enum({a[0], a[1], a[2]}); } +// ---------------------------------------------------------------------- +// Template specializations for SM_A type +// ---------------------------------------------------------------------- + template <> -void FppTest::Array::setTestVals(S (&a)[Struct::SIZE]) { - U32 b[3]; - for (U32 i = 0; i < Struct::SIZE; i++) { - for (U32 j = 0; j < 3; j++) { - b[j] = FppTest::Utils::getNonzeroU32(); - } - a[i].set(FppTest::Utils::getNonzeroU32(), b); +void FppTest::Array::setDefaultVals(U32 (&a)[SM_A::SIZE]) { + for (U32 i = 0; i < SM_A::SIZE; i++) { + a[i] = 0; } } template <> -void FppTest::Array::setTestVals(Uint32 (&a)[Uint32Array::SIZE]) { - Uint32 b; - for (U32 i = 0; i < Uint32Array::SIZE; i++) { - for (U32 j = 0; j < Uint32::SIZE; j++) { - b[j] = FppTest::Utils::getNonzeroU32(); - } - a[i] = b; +void FppTest::Array::setTestVals(U32 (&a)[SM_A::SIZE]) { + for (U32 i = 1; i < SM_A::SIZE; i++) { + a[i] = STest::Pick::any(); } } -static char stringAliasTestValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE]; - template <> -void FppTest::Array::setTestVals(Fw::ExternalString (&a)[AliasString::SIZE]) { - for (U32 i = 0; i < ::AliasString::SIZE; i++) { - a[i].setBuffer(stringAliasTestValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE); - FppTest::Utils::setString(stringAliasTestValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE, 1); - } +SM_A FppTest::Array::getMultiElementConstructedArray(U32 (&a)[SM_A::SIZE]) { + return SM_A({a[0], a[1], a[2]}); } -template <> -void FppTest::Array::setTestVals(EA (&a)[AliasOfArray::SIZE]) { - a[0] = static_cast(STest::Pick::startLength(EA::B, EA::NUM_CONSTANTS - 1)); +// ---------------------------------------------------------------------- +// Template specializations for String type +// ---------------------------------------------------------------------- - for (U32 i = 1; i < Enum::SIZE; i++) { - a[i] = static_cast(STest::Pick::startLength(EA::A, EA::NUM_CONSTANTS - 1)); - } -} +static char stringDefaultValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE]; +static char stringTestValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE]; template <> -void FppTest::Array::setTestVals(U32 (&a)[SM_A::SIZE]) { - for (U32 i = 1; i < SM_A::SIZE; i++) { - a[i] = STest::Pick::any(); +void FppTest::Array::setDefaultVals(Fw::ExternalString (&a)[::String::SIZE]) { + for (U32 i = 0; i < ::String::SIZE; i++) { + a[i].setBuffer(stringDefaultValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE); } } -// ---------------------------------------------------------------------- -// Specializations for multi element constructor -// ---------------------------------------------------------------------- - template <> -Enum FppTest::Array::getMultiElementConstructedArray(E (&a)[Enum::SIZE]) { - return Enum({a[0], a[1], a[2]}); +void FppTest::Array::setTestVals(Fw::ExternalString (&a)[::String::SIZE]) { + for (U32 i = 0; i < ::String::SIZE; i++) { + a[i].setBuffer(stringTestValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE); + FppTest::Utils::setString(stringTestValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE, 1); + } } template <> @@ -151,38 +170,55 @@ ::String FppTest::Array::getMultiElementConstructedArray<::String>(Fw::ExternalS } template <> -Struct FppTest::Array::getMultiElementConstructedArray(S (&a)[Struct::SIZE]) { - return Struct({a[0], a[1], a[2]}); +U32 FppTest::Array::getSerializedSize<::String>(Fw::ExternalString (&a)[::String::SIZE]) { + U32 serializedSize = 0; + + for (U32 i = 0; i < ::String::SIZE; i++) { + serializedSize += static_cast(a[i].serializedSize()); + } + + return serializedSize; } +// ---------------------------------------------------------------------- +// Template specializations for Struct type +// ---------------------------------------------------------------------- + template <> -Uint32Array FppTest::Array::getMultiElementConstructedArray(Uint32 (&a)[Uint32Array::SIZE]) { - return Uint32Array({a[0], a[1], a[2]}); +void FppTest::Array::setTestVals(S (&a)[Struct::SIZE]) { + U32 b[3]; + for (U32 i = 0; i < Struct::SIZE; i++) { + for (U32 j = 0; j < 3; j++) { + b[j] = FppTest::Utils::getNonzeroU32(); + } + a[i].set(FppTest::Utils::getNonzeroU32(), b); + } } template <> -SM_A FppTest::Array::getMultiElementConstructedArray(U32 (&a)[SM_A::SIZE]) { - return SM_A({a[0], a[1], a[2]}); +Struct FppTest::Array::getMultiElementConstructedArray(S (&a)[Struct::SIZE]) { + return Struct({a[0], a[1], a[2]}); } // ---------------------------------------------------------------------- -// Specializations for serialized size +// Template specializations for Uint32Array type // ---------------------------------------------------------------------- template <> -U32 FppTest::Array::getSerializedSize<::String>(Fw::ExternalString (&a)[::String::SIZE]) { - U32 serializedSize = 0; - - for (U32 i = 0; i < ::String::SIZE; i++) { - serializedSize += static_cast(a[i].serializedSize()); +void FppTest::Array::setTestVals(Uint32 (&a)[Uint32Array::SIZE]) { + Uint32 b; + for (U32 i = 0; i < Uint32Array::SIZE; i++) { + for (U32 j = 0; j < Uint32::SIZE; j++) { + b[j] = FppTest::Utils::getNonzeroU32(); + } + a[i] = b; } - - return serializedSize; } -// Instantiate string tests for arrays -using StringTestImplementations = ::testing::Types, Fw::StringTemplate<100>>; -INSTANTIATE_TYPED_TEST_SUITE_P(Array, StringTest, StringTestImplementations); +template <> +Uint32Array FppTest::Array::getMultiElementConstructedArray(Uint32 (&a)[Uint32Array::SIZE]) { + return Uint32Array({a[0], a[1], a[2]}); +} int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); From 103f47fd82ff8f45ce6c75bfa9135c3968fb4b43 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 21:35:14 -0800 Subject: [PATCH 03/30] Add missing file --- FppTestProject/FppTest/array/state_machine.fpp | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 FppTestProject/FppTest/array/state_machine.fpp diff --git a/FppTestProject/FppTest/array/state_machine.fpp b/FppTestProject/FppTest/array/state_machine.fpp new file mode 100644 index 00000000000..a7891ffbcbe --- /dev/null +++ b/FppTestProject/FppTest/array/state_machine.fpp @@ -0,0 +1,5 @@ +state machine SM { + state S + initial enter S + array A =[3] U32; +} From 7536d1f4fc041710eadf3e3ed3602c808266ea51 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 21:41:35 -0800 Subject: [PATCH 04/30] Revise FppTest array tests --- .../FppTest/array/ArrayToStringTest.cpp | 3 ++- FppTestProject/FppTest/array/CMakeLists.txt | 1 + FppTestProject/FppTest/array/component.fpp | 3 +++ FppTestProject/FppTest/array/main.cpp | 27 ++++++++++++++++++- 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 FppTestProject/FppTest/array/component.fpp diff --git a/FppTestProject/FppTest/array/ArrayToStringTest.cpp b/FppTestProject/FppTest/array/ArrayToStringTest.cpp index 80aa24b668b..e5828da1061 100644 --- a/FppTestProject/FppTest/array/ArrayToStringTest.cpp +++ b/FppTestProject/FppTest/array/ArrayToStringTest.cpp @@ -12,6 +12,7 @@ #include "FppTest/array/AliasOfArrayAliasAc.hpp" #include "FppTest/array/AliasStringArrayAc.hpp" +#include "FppTest/array/C_AArrayAc.hpp" #include "FppTest/array/EnumArrayAc.hpp" #include "FppTest/array/SM_AArrayAc.hpp" #include "FppTest/array/StringArrayAc.hpp" @@ -33,7 +34,7 @@ class ArrayToStringTest : public ::testing::Test { typename ArrayType::ElementType testVals[ArrayType::SIZE]; }; -using ArrayTypes = ::testing::Types; +using ArrayTypes = ::testing::Types; TYPED_TEST_SUITE(ArrayToStringTest, ArrayTypes); // Test array toString() and ostream operator functions diff --git a/FppTestProject/FppTest/array/CMakeLists.txt b/FppTestProject/FppTest/array/CMakeLists.txt index e777e3853cc..347047924af 100644 --- a/FppTestProject/FppTest/array/CMakeLists.txt +++ b/FppTestProject/FppTest/array/CMakeLists.txt @@ -7,6 +7,7 @@ set(SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/alias.fpp" "${CMAKE_CURRENT_LIST_DIR}/array.fpp" + "${CMAKE_CURRENT_LIST_DIR}/component.fpp" "${CMAKE_CURRENT_LIST_DIR}/enum.fpp" "${CMAKE_CURRENT_LIST_DIR}/state_machine.fpp" "${CMAKE_CURRENT_LIST_DIR}/string.fpp" diff --git a/FppTestProject/FppTest/array/component.fpp b/FppTestProject/FppTest/array/component.fpp new file mode 100644 index 00000000000..7751251931c --- /dev/null +++ b/FppTestProject/FppTest/array/component.fpp @@ -0,0 +1,3 @@ +passive component C { + array A =[3] U32; +} diff --git a/FppTestProject/FppTest/array/main.cpp b/FppTestProject/FppTest/array/main.cpp index ebded8f80d8..0e0e0986aff 100644 --- a/FppTestProject/FppTest/array/main.cpp +++ b/FppTestProject/FppTest/array/main.cpp @@ -6,6 +6,7 @@ #include "FppTest/array/AliasOfArrayAliasAc.hpp" #include "FppTest/array/AliasStringArrayAc.hpp" +#include "FppTest/array/C_AArrayAc.hpp" #include "FppTest/array/EnumArrayAc.hpp" #include "FppTest/array/SM_AArrayAc.hpp" #include "FppTest/array/StringArrayAc.hpp" @@ -24,7 +25,8 @@ // ---------------------------------------------------------------------- // Array tests -using ArrayTestImplementations = ::testing::Types; +using ArrayTestImplementations = + ::testing::Types; INSTANTIATE_TYPED_TEST_SUITE_P(FppTest, ArrayTest, ArrayTestImplementations); // String tests @@ -94,6 +96,29 @@ AliasString FppTest::Array::getMultiElementConstructedArray(Fw::Ext return AliasString({Fw::String(a[0]), Fw::String(a[1]), Fw::String(a[2])}); } +// ---------------------------------------------------------------------- +// Template specializations for C_A type +// ---------------------------------------------------------------------- + +template <> +void FppTest::Array::setDefaultVals(U32 (&a)[C_A::SIZE]) { + for (U32 i = 0; i < C_A::SIZE; i++) { + a[i] = 0; + } +} + +template <> +void FppTest::Array::setTestVals(U32 (&a)[C_A::SIZE]) { + for (U32 i = 1; i < C_A::SIZE; i++) { + a[i] = STest::Pick::any(); + } +} + +template <> +C_A FppTest::Array::getMultiElementConstructedArray(U32 (&a)[C_A::SIZE]) { + return C_A({a[0], a[1], a[2]}); +} + // ---------------------------------------------------------------------- // Template specializations for Enum type // ---------------------------------------------------------------------- From 03eb238ef0b7b860d5dd5c20dbacef07aae250cc Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 21:50:32 -0800 Subject: [PATCH 05/30] Refactor FppTest enum tests --- FppTestProject/FppTest/enum/main.cpp | 59 +++++++++++++++++----------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/FppTestProject/FppTest/enum/main.cpp b/FppTestProject/FppTest/enum/main.cpp index 9f67322a3a7..2b59c462d27 100644 --- a/FppTestProject/FppTest/enum/main.cpp +++ b/FppTestProject/FppTest/enum/main.cpp @@ -24,21 +24,27 @@ // Instantiate enum tests using EnumTestImplementations = - ::testing::Types; + ::testing::Types; INSTANTIATE_TYPED_TEST_SUITE_P(FppTest, EnumTest, EnumTestImplementations); -// Specializations for default value -template <> -Explicit::T FppTest::Enum::getDefaultValue() { - return Explicit::A; -} +// ---------------------------------------------------------------------- +// Template specializations for Default type +// ---------------------------------------------------------------------- template <> Default::T FppTest::Enum::getDefaultValue() { return Default::C; } -// Specializations for valid value +// ---------------------------------------------------------------------- +// Template specializations for Explicit type +// ---------------------------------------------------------------------- + +template <> +Explicit::T FppTest::Enum::getDefaultValue() { + return Explicit::A; +} + template <> Explicit::T FppTest::Enum::getValidValue() { U32 val = STest::Pick::startLength(0, Explicit::NUM_CONSTANTS); @@ -53,6 +59,22 @@ Explicit::T FppTest::Enum::getValidValue() { } } +template <> +Explicit::T FppTest::Enum::getInvalidValue() { + U32 sign = STest::Pick::lowerUpper(0, 1); + + switch (sign) { + case 0: + return static_cast( + STest::Pick::lowerUpper(Explicit::C + 1, std::numeric_limits::max())); + default: + return static_cast( + static_cast(STest::Pick::lowerUpper((Explicit::A - 1) * (-1), + std::numeric_limits::max())) * + (-1)); + } +} + template <> Interval::T FppTest::Enum::getValidValue() { U32 val = STest::Pick::startLength(0, Interval::NUM_CONSTANTS); @@ -75,22 +97,9 @@ Interval::T FppTest::Enum::getValidValue() { } } -// Specializations for invalid value -template <> -Explicit::T FppTest::Enum::getInvalidValue() { - U32 sign = STest::Pick::lowerUpper(0, 1); - - switch (sign) { - case 0: - return static_cast( - STest::Pick::lowerUpper(Explicit::C + 1, std::numeric_limits::max())); - default: - return static_cast( - static_cast(STest::Pick::lowerUpper((Explicit::A - 1) * (-1), - std::numeric_limits::max())) * - (-1)); - } -} +// ---------------------------------------------------------------------- +// Template specializations for Interval type +// ---------------------------------------------------------------------- template <> Interval::T FppTest::Enum::getInvalidValue() { @@ -98,6 +107,10 @@ Interval::T FppTest::Enum::getInvalidValue() { STest::Pick::lowerUpper(Interval::G + 1, std::numeric_limits::max())); } +// ---------------------------------------------------------------------- +// Main program +// ---------------------------------------------------------------------- + int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); STest::Random::seed(); From 4105e4844eed20f944955ab69d9750a7830632a5 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 21:55:37 -0800 Subject: [PATCH 06/30] Add comment --- FppTestProject/FppTest/array/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FppTestProject/FppTest/array/main.cpp b/FppTestProject/FppTest/array/main.cpp index 0e0e0986aff..1c959f91a24 100644 --- a/FppTestProject/FppTest/array/main.cpp +++ b/FppTestProject/FppTest/array/main.cpp @@ -245,6 +245,10 @@ Uint32Array FppTest::Array::getMultiElementConstructedArray(Uint32 return Uint32Array({a[0], a[1], a[2]}); } +// ---------------------------------------------------------------------- +// Main program +// ---------------------------------------------------------------------- + int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); STest::Random::seed(); From c965650f0ba170dfa04cb7d6f7080040f472cdf6 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 22:02:26 -0800 Subject: [PATCH 07/30] Revise FppTest enum tests --- FppTestProject/FppTest/enum/CMakeLists.txt | 5 +++-- FppTestProject/FppTest/enum/component.fpp | 7 +++++++ FppTestProject/FppTest/enum/main.cpp | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 FppTestProject/FppTest/enum/component.fpp diff --git a/FppTestProject/FppTest/enum/CMakeLists.txt b/FppTestProject/FppTest/enum/CMakeLists.txt index 1d3cb1cc730..1c58e187a7c 100644 --- a/FppTestProject/FppTest/enum/CMakeLists.txt +++ b/FppTestProject/FppTest/enum/CMakeLists.txt @@ -3,9 +3,10 @@ # ====================================================================== set(SOURCE_FILES - "${CMAKE_CURRENT_LIST_DIR}/implicit.fpp" - "${CMAKE_CURRENT_LIST_DIR}/explicit.fpp" + "${CMAKE_CURRENT_LIST_DIR}/component.fpp" "${CMAKE_CURRENT_LIST_DIR}/default.fpp" + "${CMAKE_CURRENT_LIST_DIR}/explicit.fpp" + "${CMAKE_CURRENT_LIST_DIR}/implicit.fpp" "${CMAKE_CURRENT_LIST_DIR}/interval.fpp" "${CMAKE_CURRENT_LIST_DIR}/serialize_type.fpp" ) diff --git a/FppTestProject/FppTest/enum/component.fpp b/FppTestProject/FppTest/enum/component.fpp new file mode 100644 index 00000000000..f050d69d531 --- /dev/null +++ b/FppTestProject/FppTest/enum/component.fpp @@ -0,0 +1,7 @@ +module FppTest { + module Enum { + passive component C { + enum E { A, B, C } + } + } +} diff --git a/FppTestProject/FppTest/enum/main.cpp b/FppTestProject/FppTest/enum/main.cpp index 2b59c462d27..7e63ad68e30 100644 --- a/FppTestProject/FppTest/enum/main.cpp +++ b/FppTestProject/FppTest/enum/main.cpp @@ -10,6 +10,7 @@ // // ====================================================================== +#include "FppTest/enum/C_EEnumAc.hpp" #include "FppTest/enum/DefaultEnumAc.hpp" #include "FppTest/enum/ExplicitEnumAc.hpp" #include "FppTest/enum/ImplicitEnumAc.hpp" @@ -24,7 +25,7 @@ // Instantiate enum tests using EnumTestImplementations = - ::testing::Types; + ::testing::Types; INSTANTIATE_TYPED_TEST_SUITE_P(FppTest, EnumTest, EnumTestImplementations); // ---------------------------------------------------------------------- From 7123de4f0d25b3bd1a20ef7f1530e7dcbf32954e Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 22:09:47 -0800 Subject: [PATCH 08/30] Revise FppTest array tests --- .../FppTest/array/ArrayToStringTest.cpp | 13 ++++- FppTestProject/FppTest/array/component.fpp | 8 ++- FppTestProject/FppTest/array/main.cpp | 56 +++++++++++-------- .../FppTest/array/state_machine.fpp | 12 ++-- 4 files changed, 57 insertions(+), 32 deletions(-) diff --git a/FppTestProject/FppTest/array/ArrayToStringTest.cpp b/FppTestProject/FppTest/array/ArrayToStringTest.cpp index e5828da1061..e67488b47d9 100644 --- a/FppTestProject/FppTest/array/ArrayToStringTest.cpp +++ b/FppTestProject/FppTest/array/ArrayToStringTest.cpp @@ -25,16 +25,21 @@ #include +namespace FppTest { + +namespace Array { + // Test array string functions template class ArrayToStringTest : public ::testing::Test { protected: - void SetUp() override { FppTest::Array::setTestVals(testVals); } + void SetUp() override { setTestVals(testVals); } typename ArrayType::ElementType testVals[ArrayType::SIZE]; }; -using ArrayTypes = ::testing::Types; +using ArrayTypes = + ::testing::Types; TYPED_TEST_SUITE(ArrayToStringTest, ArrayTypes); // Test array toString() and ostream operator functions @@ -55,3 +60,7 @@ TYPED_TEST(ArrayToStringTest, ToString) { ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); } + +} // namespace Array + +} // namespace FppTest diff --git a/FppTestProject/FppTest/array/component.fpp b/FppTestProject/FppTest/array/component.fpp index 7751251931c..ff91ef0bbb1 100644 --- a/FppTestProject/FppTest/array/component.fpp +++ b/FppTestProject/FppTest/array/component.fpp @@ -1,3 +1,7 @@ -passive component C { - array A =[3] U32; +module FppTest { + module Array { + passive component C { + array A =[3] U32; + } + } } diff --git a/FppTestProject/FppTest/array/main.cpp b/FppTestProject/FppTest/array/main.cpp index 1c959f91a24..6cb67b59721 100644 --- a/FppTestProject/FppTest/array/main.cpp +++ b/FppTestProject/FppTest/array/main.cpp @@ -20,6 +20,10 @@ #include "STest/Random/Random.hpp" #include "gtest/gtest.h" +namespace FppTest { + +namespace Array { + // ---------------------------------------------------------------------- // Test instatiations // ---------------------------------------------------------------------- @@ -38,14 +42,14 @@ INSTANTIATE_TYPED_TEST_SUITE_P(Array, StringTest, StringTestImplementations); // ---------------------------------------------------------------------- template <> -void FppTest::Array::setDefaultVals(E (&a)[Enum::SIZE]) { +void setDefaultVals(E (&a)[Enum::SIZE]) { a[0] = E::A; a[1] = E::B; a[2] = E::C; } template <> -void FppTest::Array::setTestVals(EA (&a)[AliasOfArray::SIZE]) { +void setTestVals(EA (&a)[AliasOfArray::SIZE]) { a[0] = static_cast(STest::Pick::startLength(EA::B, EA::NUM_CONSTANTS - 1)); for (U32 i = 1; i < Enum::SIZE; i++) { @@ -54,12 +58,12 @@ void FppTest::Array::setTestVals(EA (&a)[AliasOfArray::SIZE]) { } template <> -AliasOfArray FppTest::Array::getMultiElementConstructedArray(EA (&a)[AliasOfArray::SIZE]) { +AliasOfArray getMultiElementConstructedArray(EA (&a)[AliasOfArray::SIZE]) { return AliasOfArray({a[0], a[1], a[2]}); } template <> -U32 FppTest::Array::getSerializedSize(Fw::ExternalString (&a)[AliasString::SIZE]) { +U32 getSerializedSize(Fw::ExternalString (&a)[AliasString::SIZE]) { U32 serializedSize = 0; for (U32 i = 0; i < AliasString::SIZE; i++) { @@ -77,14 +81,14 @@ static char aliasStringDefaultValsBuffer[AliasString::SIZE][AliasString::ELEMENT static char aliasStringTestValsBuffer[AliasString::SIZE][AliasString::ELEMENT_BUFFER_SIZE]; template <> -void FppTest::Array::setDefaultVals(Fw::ExternalString (&a)[::AliasString::SIZE]) { +void setDefaultVals(Fw::ExternalString (&a)[::AliasString::SIZE]) { for (U32 i = 0; i < ::AliasString::SIZE; i++) { a[i].setBuffer(aliasStringDefaultValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE); } } template <> -void FppTest::Array::setTestVals(Fw::ExternalString (&a)[AliasString::SIZE]) { +void setTestVals(Fw::ExternalString (&a)[AliasString::SIZE]) { for (U32 i = 0; i < ::AliasString::SIZE; i++) { a[i].setBuffer(aliasStringTestValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE); FppTest::Utils::setString(aliasStringTestValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE, 1); @@ -92,7 +96,7 @@ void FppTest::Array::setTestVals(Fw::ExternalString (&a)[AliasStrin } template <> -AliasString FppTest::Array::getMultiElementConstructedArray(Fw::ExternalString (&a)[::String::SIZE]) { +AliasString getMultiElementConstructedArray(Fw::ExternalString (&a)[::String::SIZE]) { return AliasString({Fw::String(a[0]), Fw::String(a[1]), Fw::String(a[2])}); } @@ -101,21 +105,21 @@ AliasString FppTest::Array::getMultiElementConstructedArray(Fw::Ext // ---------------------------------------------------------------------- template <> -void FppTest::Array::setDefaultVals(U32 (&a)[C_A::SIZE]) { +void setDefaultVals(U32 (&a)[C_A::SIZE]) { for (U32 i = 0; i < C_A::SIZE; i++) { a[i] = 0; } } template <> -void FppTest::Array::setTestVals(U32 (&a)[C_A::SIZE]) { +void setTestVals(U32 (&a)[C_A::SIZE]) { for (U32 i = 1; i < C_A::SIZE; i++) { a[i] = STest::Pick::any(); } } template <> -C_A FppTest::Array::getMultiElementConstructedArray(U32 (&a)[C_A::SIZE]) { +C_A getMultiElementConstructedArray(U32 (&a)[C_A::SIZE]) { return C_A({a[0], a[1], a[2]}); } @@ -124,14 +128,14 @@ C_A FppTest::Array::getMultiElementConstructedArray(U32 (&a)[C_A::SIZE]) { // ---------------------------------------------------------------------- template <> -void FppTest::Array::setDefaultVals(E (&a)[Enum::SIZE]) { +void setDefaultVals(E (&a)[Enum::SIZE]) { a[0] = E::A; a[1] = E::B; a[2] = E::C; } template <> -void FppTest::Array::setTestVals(E (&a)[Enum::SIZE]) { +void setTestVals(E (&a)[Enum::SIZE]) { a[0] = static_cast(STest::Pick::startLength(E::B, E::NUM_CONSTANTS - 1)); for (U32 i = 1; i < Enum::SIZE; i++) { @@ -140,7 +144,7 @@ void FppTest::Array::setTestVals(E (&a)[Enum::SIZE]) { } template <> -Enum FppTest::Array::getMultiElementConstructedArray(E (&a)[Enum::SIZE]) { +Enum getMultiElementConstructedArray(E (&a)[Enum::SIZE]) { return Enum({a[0], a[1], a[2]}); } @@ -149,21 +153,21 @@ Enum FppTest::Array::getMultiElementConstructedArray(E (&a)[Enum::SIZE]) { // ---------------------------------------------------------------------- template <> -void FppTest::Array::setDefaultVals(U32 (&a)[SM_A::SIZE]) { +void setDefaultVals(U32 (&a)[SM_A::SIZE]) { for (U32 i = 0; i < SM_A::SIZE; i++) { a[i] = 0; } } template <> -void FppTest::Array::setTestVals(U32 (&a)[SM_A::SIZE]) { +void setTestVals(U32 (&a)[SM_A::SIZE]) { for (U32 i = 1; i < SM_A::SIZE; i++) { a[i] = STest::Pick::any(); } } template <> -SM_A FppTest::Array::getMultiElementConstructedArray(U32 (&a)[SM_A::SIZE]) { +SM_A getMultiElementConstructedArray(U32 (&a)[SM_A::SIZE]) { return SM_A({a[0], a[1], a[2]}); } @@ -175,14 +179,14 @@ static char stringDefaultValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZ static char stringTestValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE]; template <> -void FppTest::Array::setDefaultVals(Fw::ExternalString (&a)[::String::SIZE]) { +void setDefaultVals(Fw::ExternalString (&a)[::String::SIZE]) { for (U32 i = 0; i < ::String::SIZE; i++) { a[i].setBuffer(stringDefaultValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE); } } template <> -void FppTest::Array::setTestVals(Fw::ExternalString (&a)[::String::SIZE]) { +void setTestVals(Fw::ExternalString (&a)[::String::SIZE]) { for (U32 i = 0; i < ::String::SIZE; i++) { a[i].setBuffer(stringTestValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE); FppTest::Utils::setString(stringTestValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE, 1); @@ -190,12 +194,12 @@ void FppTest::Array::setTestVals(Fw::ExternalString (&a)[::String::SIZE] } template <> -::String FppTest::Array::getMultiElementConstructedArray<::String>(Fw::ExternalString (&a)[::String::SIZE]) { +::String getMultiElementConstructedArray<::String>(Fw::ExternalString (&a)[::String::SIZE]) { return ::String({Fw::String(a[0]), Fw::String(a[1]), Fw::String(a[2])}); } template <> -U32 FppTest::Array::getSerializedSize<::String>(Fw::ExternalString (&a)[::String::SIZE]) { +U32 getSerializedSize<::String>(Fw::ExternalString (&a)[::String::SIZE]) { U32 serializedSize = 0; for (U32 i = 0; i < ::String::SIZE; i++) { @@ -210,7 +214,7 @@ U32 FppTest::Array::getSerializedSize<::String>(Fw::ExternalString (&a)[::String // ---------------------------------------------------------------------- template <> -void FppTest::Array::setTestVals(S (&a)[Struct::SIZE]) { +void setTestVals(S (&a)[Struct::SIZE]) { U32 b[3]; for (U32 i = 0; i < Struct::SIZE; i++) { for (U32 j = 0; j < 3; j++) { @@ -221,7 +225,7 @@ void FppTest::Array::setTestVals(S (&a)[Struct::SIZE]) { } template <> -Struct FppTest::Array::getMultiElementConstructedArray(S (&a)[Struct::SIZE]) { +Struct getMultiElementConstructedArray(S (&a)[Struct::SIZE]) { return Struct({a[0], a[1], a[2]}); } @@ -230,7 +234,7 @@ Struct FppTest::Array::getMultiElementConstructedArray(S (&a)[Struct::SI // ---------------------------------------------------------------------- template <> -void FppTest::Array::setTestVals(Uint32 (&a)[Uint32Array::SIZE]) { +void setTestVals(Uint32 (&a)[Uint32Array::SIZE]) { Uint32 b; for (U32 i = 0; i < Uint32Array::SIZE; i++) { for (U32 j = 0; j < Uint32::SIZE; j++) { @@ -241,10 +245,14 @@ void FppTest::Array::setTestVals(Uint32 (&a)[Uint32Array::SIZE]) { } template <> -Uint32Array FppTest::Array::getMultiElementConstructedArray(Uint32 (&a)[Uint32Array::SIZE]) { +Uint32Array getMultiElementConstructedArray(Uint32 (&a)[Uint32Array::SIZE]) { return Uint32Array({a[0], a[1], a[2]}); } +} // namespace Array + +} // namespace FppTest + // ---------------------------------------------------------------------- // Main program // ---------------------------------------------------------------------- diff --git a/FppTestProject/FppTest/array/state_machine.fpp b/FppTestProject/FppTest/array/state_machine.fpp index a7891ffbcbe..3fff4be2e69 100644 --- a/FppTestProject/FppTest/array/state_machine.fpp +++ b/FppTestProject/FppTest/array/state_machine.fpp @@ -1,5 +1,9 @@ -state machine SM { - state S - initial enter S - array A =[3] U32; +module FppTest { + module Array { + state machine SM { + state S + initial enter S + array A =[3] U32; + } + } } From d8690b32428bb1bc2c843bc9a3ea59bf2bae2740 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 22:11:55 -0800 Subject: [PATCH 09/30] Refactor FppTest enum tests --- FppTestProject/FppTest/enum/main.cpp | 30 +++++++++++++++------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/FppTestProject/FppTest/enum/main.cpp b/FppTestProject/FppTest/enum/main.cpp index 7e63ad68e30..46311727fba 100644 --- a/FppTestProject/FppTest/enum/main.cpp +++ b/FppTestProject/FppTest/enum/main.cpp @@ -1,13 +1,7 @@ // ====================================================================== // \title main.cpp -// \author T. Chieu +// \author T. Chieu, R. Bocchino // \brief main cpp file for FPP enum tests -// -// \copyright -// Copyright (C) 2009-2022 California Institute of Technology. -// ALL RIGHTS RESERVED. United States Government Sponsorship -// acknowledged. -// // ====================================================================== #include "FppTest/enum/C_EEnumAc.hpp" @@ -23,9 +17,13 @@ #include "STest/Random/Random.hpp" #include "gtest/gtest.h" +namespace FppTest { + +namespace Enum { + // Instantiate enum tests using EnumTestImplementations = - ::testing::Types; + ::testing::Types; INSTANTIATE_TYPED_TEST_SUITE_P(FppTest, EnumTest, EnumTestImplementations); // ---------------------------------------------------------------------- @@ -33,7 +31,7 @@ INSTANTIATE_TYPED_TEST_SUITE_P(FppTest, EnumTest, EnumTestImplementations); // ---------------------------------------------------------------------- template <> -Default::T FppTest::Enum::getDefaultValue() { +Default::T getDefaultValue() { return Default::C; } @@ -42,12 +40,12 @@ Default::T FppTest::Enum::getDefaultValue() { // ---------------------------------------------------------------------- template <> -Explicit::T FppTest::Enum::getDefaultValue() { +Explicit::T getDefaultValue() { return Explicit::A; } template <> -Explicit::T FppTest::Enum::getValidValue() { +Explicit::T getValidValue() { U32 val = STest::Pick::startLength(0, Explicit::NUM_CONSTANTS); switch (val) { @@ -61,7 +59,7 @@ Explicit::T FppTest::Enum::getValidValue() { } template <> -Explicit::T FppTest::Enum::getInvalidValue() { +Explicit::T getInvalidValue() { U32 sign = STest::Pick::lowerUpper(0, 1); switch (sign) { @@ -77,7 +75,7 @@ Explicit::T FppTest::Enum::getInvalidValue() { } template <> -Interval::T FppTest::Enum::getValidValue() { +Interval::T getValidValue() { U32 val = STest::Pick::startLength(0, Interval::NUM_CONSTANTS); switch (val) { @@ -103,11 +101,15 @@ Interval::T FppTest::Enum::getValidValue() { // ---------------------------------------------------------------------- template <> -Interval::T FppTest::Enum::getInvalidValue() { +Interval::T getInvalidValue() { return static_cast( STest::Pick::lowerUpper(Interval::G + 1, std::numeric_limits::max())); } +} // namespace Enum + +} // namespace FppTest + // ---------------------------------------------------------------------- // Main program // ---------------------------------------------------------------------- From 556965de9e0033e11af51deb11432da0eba22db9 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 22:17:53 -0800 Subject: [PATCH 10/30] Refactor FppTest array tests --- FppTestProject/FppTest/array/FormatTest.cpp | 8 +++++ FppTestProject/FppTest/array/alias.fpp | 18 +++++++--- FppTestProject/FppTest/array/array.fpp | 12 +++++-- FppTestProject/FppTest/array/enum.fpp | 20 +++++++---- FppTestProject/FppTest/array/format.fpp | 36 +++++++++++-------- FppTestProject/FppTest/array/main.cpp | 40 ++++++++++----------- FppTestProject/FppTest/array/string.fpp | 6 +++- FppTestProject/FppTest/array/struct.fpp | 18 +++++++--- 8 files changed, 105 insertions(+), 53 deletions(-) diff --git a/FppTestProject/FppTest/array/FormatTest.cpp b/FppTestProject/FppTest/array/FormatTest.cpp index 4617fc2f03f..7b6fd2d8c29 100644 --- a/FppTestProject/FppTest/array/FormatTest.cpp +++ b/FppTestProject/FppTest/array/FormatTest.cpp @@ -31,6 +31,10 @@ #include #include +namespace FppTest { + +namespace Array { + // Tests FPP format strings class FormatTest : public ::testing::Test { protected: @@ -269,3 +273,7 @@ TEST_F(FormatTest, Char) { ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); } + +} // namespace Array + +} // namespace FppTest diff --git a/FppTestProject/FppTest/array/alias.fpp b/FppTestProject/FppTest/array/alias.fpp index e6258fb97db..11879dd7882 100644 --- a/FppTestProject/FppTest/array/alias.fpp +++ b/FppTestProject/FppTest/array/alias.fpp @@ -1,9 +1,17 @@ -type EA = E +module FppTest { -array ArrayOfAlias = [3] EA default [ E.A, E.B, E.C ] + module Array { -type AString = string size 32 + type EA = E -array AliasString = [3] AString + array ArrayOfAlias = [3] EA default [ E.A, E.B, E.C ] -type AliasOfArray = ArrayOfAlias + type AString = string size 32 + + array AliasString = [3] AString + + type AliasOfArray = ArrayOfAlias + + } + +} diff --git a/FppTestProject/FppTest/array/array.fpp b/FppTestProject/FppTest/array/array.fpp index a9c17a3c238..80017c934b7 100644 --- a/FppTestProject/FppTest/array/array.fpp +++ b/FppTestProject/FppTest/array/array.fpp @@ -1,3 +1,11 @@ -array Uint32 = [2] U32; +module FppTest { -array Uint32Array = [3] Uint32; + module Array { + + array Uint32 = [2] U32; + + array Uint32Array = [3] Uint32; + + } + +} diff --git a/FppTestProject/FppTest/array/enum.fpp b/FppTestProject/FppTest/array/enum.fpp index d536e606026..09beefcda7f 100644 --- a/FppTestProject/FppTest/array/enum.fpp +++ b/FppTestProject/FppTest/array/enum.fpp @@ -1,7 +1,15 @@ -enum E { - A, - B, - C, -} +module FppTest { + + module Array { + + enum E { + A, + B, + C, + } -array Enum = [3] E default [ E.A, E.B, E.C ] + array Enum = [3] E default [ E.A, E.B, E.C ] + + } + +} diff --git a/FppTestProject/FppTest/array/format.fpp b/FppTestProject/FppTest/array/format.fpp index 241ae68fc0a..dce45727851 100644 --- a/FppTestProject/FppTest/array/format.fpp +++ b/FppTestProject/FppTest/array/format.fpp @@ -1,27 +1,35 @@ -array FormatBool = [3] bool format "a {} b" +module FppTest { -array FormatU8 = [3] U8 format "a {} b" + module Array { -array FormatU16Dec = [3] U16 format "a {d} b" + array FormatBool = [3] bool format "a {} b" -array FormatU32Oct = [3] U32 format "a {o} b" + array FormatU8 = [3] U8 format "a {} b" -array FormatU64Hex = [3] U64 format "a {x} b" + array FormatU16Dec = [3] U16 format "a {d} b" -array FormatI8 = [3] I8 format "a {} b" + array FormatU32Oct = [3] U32 format "a {o} b" -array FormatI16Dec = [3] I16 format "a {d} b" + array FormatU64Hex = [3] U64 format "a {x} b" -array FormatI32Oct = [3] I32 format "a {o} b" + array FormatI8 = [3] I8 format "a {} b" -array FormatI64Hex = [3] I64 format "a {x} b" + array FormatI16Dec = [3] I16 format "a {d} b" -array FormatF32e = [3] F32 format "a {.1e} b" + array FormatI32Oct = [3] I32 format "a {o} b" -array FormatF32f = [3] F32 format "a {.2f} b" + array FormatI64Hex = [3] I64 format "a {x} b" -array FormatF64g = [3] F64 format "a {.3g} b" + array FormatF32e = [3] F32 format "a {.1e} b" -array FormatString = [3] string format "% {}" + array FormatF32f = [3] F32 format "a {.2f} b" -array FormatChar = [3] U8 format "a {c} b" + array FormatF64g = [3] F64 format "a {.3g} b" + + array FormatString = [3] string format "% {}" + + array FormatChar = [3] U8 format "a {c} b" + + } + +} diff --git a/FppTestProject/FppTest/array/main.cpp b/FppTestProject/FppTest/array/main.cpp index 6cb67b59721..f4b5cc20568 100644 --- a/FppTestProject/FppTest/array/main.cpp +++ b/FppTestProject/FppTest/array/main.cpp @@ -81,22 +81,22 @@ static char aliasStringDefaultValsBuffer[AliasString::SIZE][AliasString::ELEMENT static char aliasStringTestValsBuffer[AliasString::SIZE][AliasString::ELEMENT_BUFFER_SIZE]; template <> -void setDefaultVals(Fw::ExternalString (&a)[::AliasString::SIZE]) { - for (U32 i = 0; i < ::AliasString::SIZE; i++) { - a[i].setBuffer(aliasStringDefaultValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE); +void setDefaultVals(Fw::ExternalString (&a)[AliasString::SIZE]) { + for (U32 i = 0; i < AliasString::SIZE; i++) { + a[i].setBuffer(aliasStringDefaultValsBuffer[i], AliasString::ELEMENT_BUFFER_SIZE); } } template <> void setTestVals(Fw::ExternalString (&a)[AliasString::SIZE]) { - for (U32 i = 0; i < ::AliasString::SIZE; i++) { - a[i].setBuffer(aliasStringTestValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE); - FppTest::Utils::setString(aliasStringTestValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE, 1); + for (U32 i = 0; i < AliasString::SIZE; i++) { + a[i].setBuffer(aliasStringTestValsBuffer[i], AliasString::ELEMENT_BUFFER_SIZE); + FppTest::Utils::setString(aliasStringTestValsBuffer[i], AliasString::ELEMENT_BUFFER_SIZE, 1); } } template <> -AliasString getMultiElementConstructedArray(Fw::ExternalString (&a)[::String::SIZE]) { +AliasString getMultiElementConstructedArray(Fw::ExternalString (&a)[String::SIZE]) { return AliasString({Fw::String(a[0]), Fw::String(a[1]), Fw::String(a[2])}); } @@ -175,34 +175,34 @@ SM_A getMultiElementConstructedArray(U32 (&a)[SM_A::SIZE]) { // Template specializations for String type // ---------------------------------------------------------------------- -static char stringDefaultValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE]; -static char stringTestValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE]; +static char stringDefaultValsBuffer[String::SIZE][String::ELEMENT_BUFFER_SIZE]; +static char stringTestValsBuffer[String::SIZE][String::ELEMENT_BUFFER_SIZE]; template <> -void setDefaultVals(Fw::ExternalString (&a)[::String::SIZE]) { - for (U32 i = 0; i < ::String::SIZE; i++) { - a[i].setBuffer(stringDefaultValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE); +void setDefaultVals(Fw::ExternalString (&a)[String::SIZE]) { + for (U32 i = 0; i < String::SIZE; i++) { + a[i].setBuffer(stringDefaultValsBuffer[i], String::ELEMENT_BUFFER_SIZE); } } template <> -void setTestVals(Fw::ExternalString (&a)[::String::SIZE]) { - for (U32 i = 0; i < ::String::SIZE; i++) { - a[i].setBuffer(stringTestValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE); - FppTest::Utils::setString(stringTestValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE, 1); +void setTestVals(Fw::ExternalString (&a)[String::SIZE]) { + for (U32 i = 0; i < String::SIZE; i++) { + a[i].setBuffer(stringTestValsBuffer[i], String::ELEMENT_BUFFER_SIZE); + FppTest::Utils::setString(stringTestValsBuffer[i], String::ELEMENT_BUFFER_SIZE, 1); } } template <> -::String getMultiElementConstructedArray<::String>(Fw::ExternalString (&a)[::String::SIZE]) { - return ::String({Fw::String(a[0]), Fw::String(a[1]), Fw::String(a[2])}); +String getMultiElementConstructedArray(Fw::ExternalString (&a)[String::SIZE]) { + return String({Fw::String(a[0]), Fw::String(a[1]), Fw::String(a[2])}); } template <> -U32 getSerializedSize<::String>(Fw::ExternalString (&a)[::String::SIZE]) { +U32 getSerializedSize(Fw::ExternalString (&a)[String::SIZE]) { U32 serializedSize = 0; - for (U32 i = 0; i < ::String::SIZE; i++) { + for (U32 i = 0; i < String::SIZE; i++) { serializedSize += static_cast(a[i].serializedSize()); } diff --git a/FppTestProject/FppTest/array/string.fpp b/FppTestProject/FppTest/array/string.fpp index 027398be8a0..302dc963499 100644 --- a/FppTestProject/FppTest/array/string.fpp +++ b/FppTestProject/FppTest/array/string.fpp @@ -1 +1,5 @@ -array String = [3] string +module FppTest { + module Array { + array String = [3] string + } +} diff --git a/FppTestProject/FppTest/array/struct.fpp b/FppTestProject/FppTest/array/struct.fpp index 1c47492abe8..467bcf480dc 100644 --- a/FppTestProject/FppTest/array/struct.fpp +++ b/FppTestProject/FppTest/array/struct.fpp @@ -1,6 +1,14 @@ -struct S { - mU32: U32 - mU32Arr: [3] U32 -} +module FppTest { + + module Array { + + struct S { + mU32: U32 + mU32Arr: [3] U32 + } -array Struct = [3] S + array Struct = [3] S + + } + +} From eaeeaca108d3c8d91603094c9170507b7b0be076 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 22:22:49 -0800 Subject: [PATCH 11/30] Refactor FppTest enum tests --- .../FppTest/enum/EnumToStringTest.cpp | 20 +++--- FppTestProject/FppTest/enum/IsValidTest.cpp | 64 +++++++++---------- FppTestProject/FppTest/enum/default.fpp | 24 ++++--- FppTestProject/FppTest/enum/explicit.fpp | 18 ++++-- FppTestProject/FppTest/enum/implicit.fpp | 22 +++++-- FppTestProject/FppTest/enum/interval.fpp | 26 +++++--- .../FppTest/enum/serialize_type.fpp | 36 +++++++---- 7 files changed, 123 insertions(+), 87 deletions(-) diff --git a/FppTestProject/FppTest/enum/EnumToStringTest.cpp b/FppTestProject/FppTest/enum/EnumToStringTest.cpp index 8441facfee8..6b45690e5e8 100644 --- a/FppTestProject/FppTest/enum/EnumToStringTest.cpp +++ b/FppTestProject/FppTest/enum/EnumToStringTest.cpp @@ -1,13 +1,7 @@ // ====================================================================== // \title EnumToStringTest.cpp -// \author T. Chieu +// \author T. Chieu, R. Bocchino // \brief cpp file for EnumToStringTest class -// -// \copyright -// Copyright (C) 2009-2022 California Institute of Technology. -// ALL RIGHTS RESERVED. United States Government Sponsorship -// acknowledged. -// // ====================================================================== #include "FppTest/enum/DefaultEnumAc.hpp" @@ -24,6 +18,8 @@ namespace FppTest { +namespace Enum { + // Populate an array with enum values template void setEnumValArray(typename EnumType::T (&a)[EnumType::NUM_CONSTANTS + 1]) { @@ -83,15 +79,13 @@ void setEnumStrArray(std::string (&a)[Interval::NUM_CONSTANTS + 1]) { a[7] = "[invalid] (11)"; } -} // namespace FppTest - // Test enum string functions template class EnumToStringTest : public ::testing::Test { protected: void SetUp() override { - FppTest::setEnumValArray(vals); - FppTest::setEnumStrArray(strs); + setEnumValArray(vals); + setEnumStrArray(strs); }; EnumType e; @@ -116,3 +110,7 @@ TYPED_TEST(EnumToStringTest, ToString) { this->buf.str(""); } } + +} // namespace Enum + +} // namespace FppTest diff --git a/FppTestProject/FppTest/enum/IsValidTest.cpp b/FppTestProject/FppTest/enum/IsValidTest.cpp index 8c1d02d9cd4..8bcc51d32b8 100644 --- a/FppTestProject/FppTest/enum/IsValidTest.cpp +++ b/FppTestProject/FppTest/enum/IsValidTest.cpp @@ -1,54 +1,52 @@ // ====================================================================== // \title IsValidTest.cpp -// \author T. Chieu +// \author T. Chieu, R. Bocchino // \brief cpp file for IsValidTest class -// -// \copyright -// Copyright (C) 2009-2022 California Institute of Technology. -// ALL RIGHTS RESERVED. United States Government Sponsorship -// acknowledged. -// // ====================================================================== #include "FppTest/enum/IntervalEnumAc.hpp" #include "gtest/gtest.h" -// Test boundary values for enum isValid() function -TEST(IsValidTest, IntervalEnum) { - Interval e = static_cast(-1); - ASSERT_FALSE(e.isValid()); +module FppTest { + module Enum { + // Test boundary values for enum isValid() function + TEST(IsValidTest, IntervalEnum) { + Interval e = static_cast(-1); + ASSERT_FALSE(e.isValid()); - e = static_cast(0); - ASSERT_TRUE(e.isValid()); + e = static_cast(0); + ASSERT_TRUE(e.isValid()); - e = static_cast(1); - ASSERT_FALSE(e.isValid()); + e = static_cast(1); + ASSERT_FALSE(e.isValid()); - e = static_cast(2); - ASSERT_FALSE(e.isValid()); + e = static_cast(2); + ASSERT_FALSE(e.isValid()); - e = static_cast(3); - ASSERT_TRUE(e.isValid()); + e = static_cast(3); + ASSERT_TRUE(e.isValid()); - e = static_cast(5); - ASSERT_TRUE(e.isValid()); + e = static_cast(5); + ASSERT_TRUE(e.isValid()); - e = static_cast(6); - ASSERT_FALSE(e.isValid()); + e = static_cast(6); + ASSERT_FALSE(e.isValid()); - e = static_cast(10); - ASSERT_TRUE(e.isValid()); + e = static_cast(10); + ASSERT_TRUE(e.isValid()); - e = static_cast(99); - ASSERT_FALSE(e.isValid()); + e = static_cast(99); + ASSERT_FALSE(e.isValid()); - e = static_cast(100); - ASSERT_TRUE(e.isValid()); + e = static_cast(100); + ASSERT_TRUE(e.isValid()); - e = static_cast(101); - ASSERT_TRUE(e.isValid()); + e = static_cast(101); + ASSERT_TRUE(e.isValid()); - e = static_cast(102); - ASSERT_FALSE(e.isValid()); + e = static_cast(102); + ASSERT_FALSE(e.isValid()); + } + } } diff --git a/FppTestProject/FppTest/enum/default.fpp b/FppTestProject/FppTest/enum/default.fpp index d06a22fc226..94e78ae3179 100644 --- a/FppTestProject/FppTest/enum/default.fpp +++ b/FppTestProject/FppTest/enum/default.fpp @@ -1,8 +1,16 @@ -@ An enum with specified default values -enum Default { - A, - B, - C, - D, - E, -} default C +module FppTest { + + module Enum { + + @ An enum with specified default values + enum Default { + A, + B, + C, + D, + E, + } default C + + } + +} diff --git a/FppTestProject/FppTest/enum/explicit.fpp b/FppTestProject/FppTest/enum/explicit.fpp index 0e3746477c3..07667291471 100644 --- a/FppTestProject/FppTest/enum/explicit.fpp +++ b/FppTestProject/FppTest/enum/explicit.fpp @@ -1,6 +1,14 @@ -@ An enum with explicit constant values -enum Explicit { - A = -1952875139, - B = 2, - C = 2000999333, +module FppTest { + + module Enum { + + @ An enum with explicit constant values + enum Explicit { + A = -1952875139, + B = 2, + C = 2000999333, + } + + } + } diff --git a/FppTestProject/FppTest/enum/implicit.fpp b/FppTestProject/FppTest/enum/implicit.fpp index 617e4ec1f1f..ffd1f87d36f 100644 --- a/FppTestProject/FppTest/enum/implicit.fpp +++ b/FppTestProject/FppTest/enum/implicit.fpp @@ -1,8 +1,16 @@ -@ An enum with implicit constant values -enum Implicit { - A, @< Member A - B, - C, - D, - E, +module FppTest { + + module Enum { + + @ An enum with implicit constant values + enum Implicit { + A, @< Member A + B, + C, + D, + E, + } + + } + } diff --git a/FppTestProject/FppTest/enum/interval.fpp b/FppTestProject/FppTest/enum/interval.fpp index 09e73091e68..7757f2cf7a7 100644 --- a/FppTestProject/FppTest/enum/interval.fpp +++ b/FppTestProject/FppTest/enum/interval.fpp @@ -1,10 +1,18 @@ -@ An enum with many intervals of values -enum Interval { - A = 0, - B = 3, - C = 4, - D = 5, - E = 10, - F = 100, - G = 101, +module FppTest { + + module Enum { + + @ An enum with many intervals of values + enum Interval { + A = 0, + B = 3, + C = 4, + D = 5, + E = 10, + F = 100, + G = 101, + } + + } + } diff --git a/FppTestProject/FppTest/enum/serialize_type.fpp b/FppTestProject/FppTest/enum/serialize_type.fpp index af8e3d370fd..5e6025c2320 100644 --- a/FppTestProject/FppTest/enum/serialize_type.fpp +++ b/FppTestProject/FppTest/enum/serialize_type.fpp @@ -1,16 +1,24 @@ -@ An enum with a specified serialize type -enum SerializeTypeU8 : U8 { - A, - B, - C, - D, - E, -} +module FppTest { + + module Enum { + + @ An enum with a specified serialize type + enum SerializeTypeU8 : U8 { + A, + B, + C, + D, + E, + } + + enum SerializeTypeU64 : U64 { + A, + B, + C, + D, + E, + } + + } -enum SerializeTypeU64 : U64 { - A, - B, - C, - D, - E, } From 7b0915ce9db31ea40d4178be2ee4098879d8fb62 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 22:25:15 -0800 Subject: [PATCH 12/30] Revise FppTest enum tests --- FppTestProject/FppTest/enum/CMakeLists.txt | 1 + FppTestProject/FppTest/enum/main.cpp | 3 ++- FppTestProject/FppTest/enum/state_machine.fpp | 9 +++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 FppTestProject/FppTest/enum/state_machine.fpp diff --git a/FppTestProject/FppTest/enum/CMakeLists.txt b/FppTestProject/FppTest/enum/CMakeLists.txt index 1c58e187a7c..4da25f40947 100644 --- a/FppTestProject/FppTest/enum/CMakeLists.txt +++ b/FppTestProject/FppTest/enum/CMakeLists.txt @@ -9,6 +9,7 @@ set(SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/implicit.fpp" "${CMAKE_CURRENT_LIST_DIR}/interval.fpp" "${CMAKE_CURRENT_LIST_DIR}/serialize_type.fpp" + "${CMAKE_CURRENT_LIST_DIR}/state_machine.fpp" ) register_fprime_module() diff --git a/FppTestProject/FppTest/enum/main.cpp b/FppTestProject/FppTest/enum/main.cpp index 46311727fba..f08570936ca 100644 --- a/FppTestProject/FppTest/enum/main.cpp +++ b/FppTestProject/FppTest/enum/main.cpp @@ -9,6 +9,7 @@ #include "FppTest/enum/ExplicitEnumAc.hpp" #include "FppTest/enum/ImplicitEnumAc.hpp" #include "FppTest/enum/IntervalEnumAc.hpp" +#include "FppTest/enum/SM_EEnumAc.hpp" #include "FppTest/enum/SerializeTypeU64EnumAc.hpp" #include "FppTest/enum/SerializeTypeU8EnumAc.hpp" @@ -23,7 +24,7 @@ namespace Enum { // Instantiate enum tests using EnumTestImplementations = - ::testing::Types; + ::testing::Types; INSTANTIATE_TYPED_TEST_SUITE_P(FppTest, EnumTest, EnumTestImplementations); // ---------------------------------------------------------------------- diff --git a/FppTestProject/FppTest/enum/state_machine.fpp b/FppTestProject/FppTest/enum/state_machine.fpp new file mode 100644 index 00000000000..e905becc345 --- /dev/null +++ b/FppTestProject/FppTest/enum/state_machine.fpp @@ -0,0 +1,9 @@ +module FppTest { + module Enum { + state machine SM { + state S + initial enter S + enum E { A, B, C } + } + } +} From 8eb9f6b6ea18c05236764ddc6c579dd666392a54 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 22:51:57 -0800 Subject: [PATCH 13/30] Refactor FppTest struct tests --- .../FppTest/struct/NonPrimitiveStructTest.cpp | 16 ++-- .../FppTest/struct/PrimitiveStructTest.cpp | 16 ++-- FppTestProject/FppTest/struct/struct.fpp | 82 ++++++++++--------- 3 files changed, 63 insertions(+), 51 deletions(-) diff --git a/FppTestProject/FppTest/struct/NonPrimitiveStructTest.cpp b/FppTestProject/FppTest/struct/NonPrimitiveStructTest.cpp index 76d5965faf6..b2088ff4e26 100644 --- a/FppTestProject/FppTest/struct/NonPrimitiveStructTest.cpp +++ b/FppTestProject/FppTest/struct/NonPrimitiveStructTest.cpp @@ -1,13 +1,7 @@ // ====================================================================== // \title NonPrimitiveStructTest.cpp -// \author T. Chieu +// \author T. Chieu, R. Bocchino // \brief cpp file for NonPrimitiveStructTest class -// -// \copyright -// Copyright (C) 2009-2022 California Institute of Technology. -// ALL RIGHTS RESERVED. United States Government Sponsorship -// acknowledged. -// // ====================================================================== #include "FppTest/struct/NonPrimitiveSerializableAc.hpp" @@ -22,6 +16,10 @@ #include +namespace FppTest { + +namespace Struct { + // Test NonPrimitive struct class class NonPrimitiveStructTest : public ::testing::Test { protected: @@ -303,3 +301,7 @@ TEST_F(NonPrimitiveStructTest, ToString) { ASSERT_STREQ(buf1.str().c_str(), s2.toChar()); } + +} // namespace Struct + +} // namespace FppTest diff --git a/FppTestProject/FppTest/struct/PrimitiveStructTest.cpp b/FppTestProject/FppTest/struct/PrimitiveStructTest.cpp index 95422b6bb1c..1bba545b565 100644 --- a/FppTestProject/FppTest/struct/PrimitiveStructTest.cpp +++ b/FppTestProject/FppTest/struct/PrimitiveStructTest.cpp @@ -1,13 +1,7 @@ // ====================================================================== // \title PrimitiveStructTest.cpp -// \author T. Chieu +// \author T. Chieu, R. Bocchino // \brief cpp file for PrimitiveStructTest class -// -// \copyright -// Copyright (C) 2009-2022 California Institute of Technology. -// ALL RIGHTS RESERVED. United States Government Sponsorship -// acknowledged. -// // ====================================================================== #include "FppTest/struct/PrimitiveSerializableAc.hpp" @@ -21,6 +15,10 @@ #include +namespace FppTest { + +namespace Struct { + // Test Primitive struct class class PrimitiveStructTest : public ::testing::Test { protected: @@ -201,3 +199,7 @@ TEST_F(PrimitiveStructTest, ToString) { ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); } + +} // namespace Struct + +} // namespace FppTest diff --git a/FppTestProject/FppTest/struct/struct.fpp b/FppTestProject/FppTest/struct/struct.fpp index bd4bba381fa..c023ffed51d 100644 --- a/FppTestProject/FppTest/struct/struct.fpp +++ b/FppTestProject/FppTest/struct/struct.fpp @@ -1,40 +1,48 @@ -enum StructEnum { A, B, C } -array StructArray = [3] U32 -type StructArrAlias = StructArray - -struct Primitive { - mBool: bool - mU32: U32 - mI16: I16 - mF64: F64 -} +module FppTest { -type StructSAlias = Primitive - -struct NonPrimitive { - mString: string - mEnum: StructEnum - mArray: StructArray - mAliasStructAlias: StructArrAlias - mStruct: Primitive - mAliasStruct: StructSAlias - mU32Arr: [3] U32 - mStructArr: [3] Primitive -} default { - mEnum = StructEnum.C - mStruct = { mBool = true, mF64 = 3.14 } - mStructArr = { mBool = true, mF64 = 1.16 } -} + module Struct { + + enum StructEnum { A, B, C } + array StructArray = [3] U32 + type StructArrAlias = StructArray + + struct Primitive { + mBool: bool + mU32: U32 + mI16: I16 + mF64: F64 + } + + type StructSAlias = Primitive + + struct NonPrimitive { + mString: string + mEnum: StructEnum + mArray: StructArray + mAliasStructAlias: StructArrAlias + mStruct: Primitive + mAliasStruct: StructSAlias + mU32Arr: [3] U32 + mStructArr: [3] Primitive + } default { + mEnum = StructEnum.C + mStruct = { mBool = true, mF64 = 3.14 } + mStructArr = { mBool = true, mF64 = 1.16 } + } + + type StructAliasString = string size 30 + + struct MultiString { + mStr_1: string + mStr_2: string + mStr50_1: string size 50 + mStr50_2: string size 50 + mStrArr_1: [3] string size 60 + mStrArr_2: [3] string size 60 + mStrAlias: StructAliasString + mStrAlias_2: [3] StructAliasString + } + + } -type StructAliasString = string size 30 - -struct MultiString { - mStr_1: string - mStr_2: string - mStr50_1: string size 50 - mStr50_2: string size 50 - mStrArr_1: [3] string size 60 - mStrArr_2: [3] string size 60 - mStrAlias: StructAliasString - mStrAlias_2: [3] StructAliasString } From 963e9a27d9fce38dece25e9d9aa1f9e499235962 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 23:35:13 -0800 Subject: [PATCH 14/30] Revise FppTest struct tests --- FppTestProject/FppTest/struct/CMakeLists.txt | 4 +- .../FppTest/struct/PrimitiveStructTest.cpp | 205 ---------------- .../FppTest/struct/PrimitiveTest.cpp | 224 ++++++++++++++++++ 3 files changed, 226 insertions(+), 207 deletions(-) delete mode 100644 FppTestProject/FppTest/struct/PrimitiveStructTest.cpp create mode 100644 FppTestProject/FppTest/struct/PrimitiveTest.cpp diff --git a/FppTestProject/FppTest/struct/CMakeLists.txt b/FppTestProject/FppTest/struct/CMakeLists.txt index eb13601e32d..bec4248aa4e 100644 --- a/FppTestProject/FppTest/struct/CMakeLists.txt +++ b/FppTestProject/FppTest/struct/CMakeLists.txt @@ -15,9 +15,9 @@ set(UT_MOD_DEPS # List all .cpp files as UT_SOURCE_FILES. Only the UT build is allowed. set(UT_SOURCE_FILES - "${CMAKE_CURRENT_LIST_DIR}/PrimitiveStructTest.cpp" - "${CMAKE_CURRENT_LIST_DIR}/NonPrimitiveStructTest.cpp" "${CMAKE_CURRENT_LIST_DIR}/../utils/Utils.cpp" + "${CMAKE_CURRENT_LIST_DIR}/NonPrimitiveStructTest.cpp" + "${CMAKE_CURRENT_LIST_DIR}/PrimitiveTest.cpp" "${CMAKE_CURRENT_LIST_DIR}/main.cpp" ) register_fprime_ut() diff --git a/FppTestProject/FppTest/struct/PrimitiveStructTest.cpp b/FppTestProject/FppTest/struct/PrimitiveStructTest.cpp deleted file mode 100644 index 1bba545b565..00000000000 --- a/FppTestProject/FppTest/struct/PrimitiveStructTest.cpp +++ /dev/null @@ -1,205 +0,0 @@ -// ====================================================================== -// \title PrimitiveStructTest.cpp -// \author T. Chieu, R. Bocchino -// \brief cpp file for PrimitiveStructTest class -// ====================================================================== - -#include "FppTest/struct/PrimitiveSerializableAc.hpp" -#include "FppTest/utils/Utils.hpp" - -#include "Fw/Types/SerialBuffer.hpp" -#include "Fw/Types/StringUtils.hpp" -#include "STest/Pick/Pick.hpp" - -#include "gtest/gtest.h" - -#include - -namespace FppTest { - -namespace Struct { - -// Test Primitive struct class -class PrimitiveStructTest : public ::testing::Test { - protected: - void SetUp() override { - testBool = true; - testU32 = FppTest::Utils::getNonzeroU32(); - testI16 = static_cast(FppTest::Utils::getNonzeroU32()); - testF64 = static_cast(FppTest::Utils::getNonzeroU32()); - } - - void assertStructMembers(const Primitive& s) { - ASSERT_EQ(s.get_mBool(), testBool); - ASSERT_EQ(s.get_mU32(), testU32); - ASSERT_EQ(s.get_mI16(), testI16); - ASSERT_EQ(s.get_mF64(), testF64); - } - - void assertUnsuccessfulSerialization(Primitive& s, U32 bufSize) { - // Avoid creating an array of size zero - U8 data[bufSize + 1]; - Fw::SerialBuffer buf(data, bufSize); - Fw::SerializeStatus status; - - // Serialize - status = buf.serializeFrom(s); - ASSERT_NE(status, Fw::FW_SERIALIZE_OK); - - // Deserialize - status = buf.deserializeTo(s); - ASSERT_NE(status, Fw::FW_SERIALIZE_OK); - } - - bool testBool; - U32 testU32; - I16 testI16; - F64 testF64; -}; - -// Test struct constants and default constructor -TEST_F(PrimitiveStructTest, Default) { - Primitive s; - - // Constants - ASSERT_EQ(Primitive::SERIALIZED_SIZE, sizeof(U8) + sizeof(U32) + sizeof(I16) + sizeof(F64)); - - // Default constructor - ASSERT_EQ(s.get_mBool(), false); - ASSERT_EQ(s.get_mU32(), 0); - ASSERT_EQ(s.get_mI16(), 0); - ASSERT_EQ(s.get_mF64(), 0.0); -} - -// Test struct constructors -TEST_F(PrimitiveStructTest, Constructors) { - // Member constructor - Primitive s1(testBool, testU32, testI16, testF64); - assertStructMembers(s1); - - // Copy constructor - Primitive s2(s1); - assertStructMembers(s2); -} - -// Test struct assignment operator -TEST_F(PrimitiveStructTest, AssignmentOp) { - Primitive s1; - Primitive s2(testBool, testU32, testI16, testF64); - - // Copy assignment - s1 = s2; - assertStructMembers(s1); - - Primitive& s1Ref = s1; - s1 = s1Ref; - ASSERT_EQ(&s1, &s1Ref); -} - -// Test struct equality and inequality operators -TEST_F(PrimitiveStructTest, EqualityOp) { - Primitive s1, s2; - - ASSERT_TRUE(s1 == s2); - ASSERT_FALSE(s1 != s2); - - s1.set_mBool(testBool); - - ASSERT_FALSE(s1 == s2); - ASSERT_TRUE(s1 != s2); - - s2.set_mBool(testBool); - s1.set_mU32(testU32); - - ASSERT_FALSE(s1 == s2); - ASSERT_TRUE(s1 != s2); - - s2.set_mU32(testU32); - s1.set_mI16(testI16); - - ASSERT_FALSE(s1 == s2); - ASSERT_TRUE(s1 != s2); - - s2.set_mI16(testI16); - s1.set_mF64(testF64); - - ASSERT_FALSE(s1 == s2); - ASSERT_TRUE(s1 != s2); - - s2.set_mF64(testF64); - - ASSERT_TRUE(s1 == s2); - ASSERT_FALSE(s1 != s2); -} - -// Test struct getter and setter functions -TEST_F(PrimitiveStructTest, GetterSetterFunctions) { - Primitive s1, s2; - - // Set all members - s1.set(testBool, testU32, testI16, testF64); - assertStructMembers(s1); - - // Set individual members - s2.set_mBool(testBool); - ASSERT_EQ(s2.get_mBool(), testBool); - - s2.set_mU32(testU32); - ASSERT_EQ(s2.get_mU32(), testU32); - - s2.set_mI16(testI16); - ASSERT_EQ(s2.get_mI16(), testI16); - - s2.set_mF64(testF64); - ASSERT_EQ(s2.get_mF64(), testF64); -} - -// Test struct serialization and deserialization -TEST_F(PrimitiveStructTest, Serialization) { - Primitive s(testBool, testU32, testI16, testF64); - Primitive sCopy; - - Fw::SerializeStatus status; - - // Test successful serialization - U8 data[Primitive::SERIALIZED_SIZE]; - Fw::SerialBuffer buf(data, sizeof(data)); - - // Serialize - status = buf.serializeFrom(s); - - ASSERT_EQ(status, Fw::FW_SERIALIZE_OK); - ASSERT_EQ(buf.getSize(), Primitive::SERIALIZED_SIZE); - - // Deserialize - status = buf.deserializeTo(sCopy); - - ASSERT_EQ(status, Fw::FW_SERIALIZE_OK); - ASSERT_EQ(s, sCopy); - - // Test unsuccessful serialization - assertUnsuccessfulSerialization(s, sizeof(U8) - 1); - assertUnsuccessfulSerialization(s, sizeof(U8) + sizeof(U32) - 1); - assertUnsuccessfulSerialization(s, sizeof(U8) + sizeof(U32) + sizeof(I16) - 1); - assertUnsuccessfulSerialization(s, Primitive::SERIALIZED_SIZE - 1); -} - -// Test struct toString() and ostream operator functions -TEST_F(PrimitiveStructTest, ToString) { - Primitive s(testBool, testU32, testI16, testF64); - std::stringstream buf1, buf2; - - buf1 << s; - - buf2 << "( " - << "mBool = " << testBool << ", " - << "mU32 = " << testU32 << ", " - << "mI16 = " << testI16 << ", " - << "mF64 = " << std::fixed << testF64 << " )"; - - ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); -} - -} // namespace Struct - -} // namespace FppTest diff --git a/FppTestProject/FppTest/struct/PrimitiveTest.cpp b/FppTestProject/FppTest/struct/PrimitiveTest.cpp new file mode 100644 index 00000000000..fc65300b3fc --- /dev/null +++ b/FppTestProject/FppTest/struct/PrimitiveTest.cpp @@ -0,0 +1,224 @@ +// ====================================================================== +// \title PrimitiveTest +// \author R. Bocchino +// \brief cpp file for primitive struct tests +// ====================================================================== + +#include + +#include "FppTest/struct/PrimitiveSerializableAc.hpp" +#include "FppTest/utils/Utils.hpp" +#include "Fw/Types/SerialBuffer.hpp" +#include "Fw/Types/StringUtils.hpp" +#include "STest/Pick/Pick.hpp" +#include "gtest/gtest.h" + +namespace FppTest { + +namespace Struct { + +template +class PrimitiveTest : public ::testing::Test { + protected: + void SetUp() override { + testBool = true; + testU32 = FppTest::Utils::getNonzeroU32(); + testI16 = static_cast(FppTest::Utils::getNonzeroU32()); + testF64 = static_cast(FppTest::Utils::getNonzeroU32()); + } + + void assertStructMembers(const T& s) { + ASSERT_EQ(s.get_mBool(), testBool); + ASSERT_EQ(s.get_mU32(), testU32); + ASSERT_EQ(s.get_mI16(), testI16); + ASSERT_EQ(s.get_mF64(), testF64); + } + + void assertUnsuccessfulSerialization(T& s, U32 bufSize) { + // Avoid creating an array of size zero + U8 data[bufSize + 1]; + Fw::SerialBuffer buf(data, bufSize); + Fw::SerializeStatus status; + + // Serialize + status = buf.serializeFrom(s); + ASSERT_NE(status, Fw::FW_SERIALIZE_OK); + + // Deserialize + status = buf.deserializeTo(s); + ASSERT_NE(status, Fw::FW_SERIALIZE_OK); + } + + bool testBool; + U32 testU32; + I16 testI16; + F64 testF64; +}; + +TYPED_TEST_SUITE_P(PrimitiveTest); + +// Test struct constants and default constructor +TYPED_TEST_P(PrimitiveTest, Default) { + TypeParam s; + + // Constants + ASSERT_EQ(TypeParam::SERIALIZED_SIZE, sizeof(U8) + sizeof(U32) + sizeof(I16) + sizeof(F64)); + + // Default constructor + ASSERT_EQ(s.get_mBool(), false); + ASSERT_EQ(s.get_mU32(), 0); + ASSERT_EQ(s.get_mI16(), 0); + ASSERT_EQ(s.get_mF64(), 0.0); +} + +// Test struct constructors +TYPED_TEST_P(PrimitiveTest, Constructors) { + // Member constructor + TypeParam s1(this->testBool, this->testU32, this->testI16, this->testF64); + this->assertStructMembers(s1); + + // Copy constructor + TypeParam s2(s1); + this->assertStructMembers(s2); +} + +// Test struct assignment operator +TYPED_TEST_P(PrimitiveTest, AssignmentOp) { + TypeParam s1; + TypeParam s2(this->testBool, this->testU32, this->testI16, this->testF64); + + // Copy assignment + s1 = s2; + this->assertStructMembers(s1); + + TypeParam& s1Ref = s1; + s1 = s1Ref; + ASSERT_EQ(&s1, &s1Ref); +} + +// Test struct equality and inequality operators +TYPED_TEST_P(PrimitiveTest, EqualityOp) { + TypeParam s1, s2; + + ASSERT_TRUE(s1 == s2); + ASSERT_FALSE(s1 != s2); + + s1.set_mBool(this->testBool); + + ASSERT_FALSE(s1 == s2); + ASSERT_TRUE(s1 != s2); + + s2.set_mBool(this->testBool); + s1.set_mU32(this->testU32); + + ASSERT_FALSE(s1 == s2); + ASSERT_TRUE(s1 != s2); + + s2.set_mU32(this->testU32); + s1.set_mI16(this->testI16); + + ASSERT_FALSE(s1 == s2); + ASSERT_TRUE(s1 != s2); + + s2.set_mI16(this->testI16); + s1.set_mF64(this->testF64); + + ASSERT_FALSE(s1 == s2); + ASSERT_TRUE(s1 != s2); + + s2.set_mF64(this->testF64); + + ASSERT_TRUE(s1 == s2); + ASSERT_FALSE(s1 != s2); +} + +// Test struct getter and setter functions +TYPED_TEST_P(PrimitiveTest, GetterSetterFunctions) { + TypeParam s1, s2; + + // Set all members + s1.set(this->testBool, this->testU32, this->testI16, this->testF64); + this->assertStructMembers(s1); + + // Set individual members + s2.set_mBool(this->testBool); + ASSERT_EQ(s2.get_mBool(), this->testBool); + + s2.set_mU32(this->testU32); + ASSERT_EQ(s2.get_mU32(), this->testU32); + + s2.set_mI16(this->testI16); + ASSERT_EQ(s2.get_mI16(), this->testI16); + + s2.set_mF64(this->testF64); + ASSERT_EQ(s2.get_mF64(), this->testF64); +} + +// Test struct serialization and deserialization +TYPED_TEST_P(PrimitiveTest, Serialization) { + TypeParam s(this->testBool, this->testU32, this->testI16, this->testF64); + TypeParam sCopy; + + Fw::SerializeStatus status; + + // Test successful serialization + U8 data[TypeParam::SERIALIZED_SIZE]; + Fw::SerialBuffer buf(data, sizeof(data)); + + // Serialize + status = buf.serializeFrom(s); + + ASSERT_EQ(status, Fw::FW_SERIALIZE_OK); + ASSERT_EQ(buf.getSize(), TypeParam::SERIALIZED_SIZE); + + // Deserialize + status = buf.deserializeTo(sCopy); + + ASSERT_EQ(status, Fw::FW_SERIALIZE_OK); + ASSERT_EQ(s, sCopy); + + // Test unsuccessful serialization + this->assertUnsuccessfulSerialization(s, sizeof(U8) - 1); + this->assertUnsuccessfulSerialization(s, sizeof(U8) + sizeof(U32) - 1); + this->assertUnsuccessfulSerialization(s, sizeof(U8) + sizeof(U32) + sizeof(I16) - 1); + this->assertUnsuccessfulSerialization(s, TypeParam::SERIALIZED_SIZE - 1); +} + +// Test serialized size +TYPED_TEST_P(PrimitiveTest, SerializedSize) { + TypeParam s; + ASSERT_EQ(s.serializedSize(), sizeof(U8) + sizeof(U32) + sizeof(I16) + sizeof(F64)); +} + +// Test struct toString() and ostream operator functions +TYPED_TEST_P(PrimitiveTest, ToString) { + TypeParam s(this->testBool, this->testU32, this->testI16, this->testF64); + std::stringstream buf1, buf2; + + buf1 << s; + + buf2 << "( " + << "mBool = " << this->testBool << ", " + << "mU32 = " << this->testU32 << ", " + << "mI16 = " << this->testI16 << ", " + << "mF64 = " << std::fixed << this->testF64 << " )"; + + ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); +} + +REGISTER_TYPED_TEST_SUITE_P(PrimitiveTest, + Default, + Constructors, + AssignmentOp, + EqualityOp, + GetterSetterFunctions, + Serialization, + SerializedSize, + ToString); + +using PrimitiveTestImplementations = ::testing::Types; +INSTANTIATE_TYPED_TEST_SUITE_P(FppTest, PrimitiveTest, PrimitiveTestImplementations); + +} // namespace Struct + +} // namespace FppTest From e400c1bab883899bfa3e6a26994d33d946a2de2c Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 23:37:02 -0800 Subject: [PATCH 15/30] Refactor FppTest struct tests --- FppTestProject/FppTest/struct/CMakeLists.txt | 2 +- ...iveStructTest.cpp => NonPrimitiveTest.cpp} | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) rename FppTestProject/FppTest/struct/{NonPrimitiveStructTest.cpp => NonPrimitiveTest.cpp} (95%) diff --git a/FppTestProject/FppTest/struct/CMakeLists.txt b/FppTestProject/FppTest/struct/CMakeLists.txt index bec4248aa4e..6d5a9ab222d 100644 --- a/FppTestProject/FppTest/struct/CMakeLists.txt +++ b/FppTestProject/FppTest/struct/CMakeLists.txt @@ -16,7 +16,7 @@ set(UT_MOD_DEPS # List all .cpp files as UT_SOURCE_FILES. Only the UT build is allowed. set(UT_SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/../utils/Utils.cpp" - "${CMAKE_CURRENT_LIST_DIR}/NonPrimitiveStructTest.cpp" + "${CMAKE_CURRENT_LIST_DIR}/NonPrimitiveTest.cpp" "${CMAKE_CURRENT_LIST_DIR}/PrimitiveTest.cpp" "${CMAKE_CURRENT_LIST_DIR}/main.cpp" ) diff --git a/FppTestProject/FppTest/struct/NonPrimitiveStructTest.cpp b/FppTestProject/FppTest/struct/NonPrimitiveTest.cpp similarity index 95% rename from FppTestProject/FppTest/struct/NonPrimitiveStructTest.cpp rename to FppTestProject/FppTest/struct/NonPrimitiveTest.cpp index b2088ff4e26..4423afb8790 100644 --- a/FppTestProject/FppTest/struct/NonPrimitiveStructTest.cpp +++ b/FppTestProject/FppTest/struct/NonPrimitiveTest.cpp @@ -1,7 +1,7 @@ // ====================================================================== -// \title NonPrimitiveStructTest.cpp +// \title NonPrimitiveTest.cpp // \author T. Chieu, R. Bocchino -// \brief cpp file for NonPrimitiveStructTest class +// \brief cpp file for NonPrimitiveTest class // ====================================================================== #include "FppTest/struct/NonPrimitiveSerializableAc.hpp" @@ -21,7 +21,7 @@ namespace FppTest { namespace Struct { // Test NonPrimitive struct class -class NonPrimitiveStructTest : public ::testing::Test { +class NonPrimitiveTest : public ::testing::Test { protected: void SetUp() override { char buf[testString.getCapacity()]; @@ -86,7 +86,7 @@ class NonPrimitiveStructTest : public ::testing::Test { }; // Test struct constants and default constructor -TEST_F(NonPrimitiveStructTest, Default) { +TEST_F(NonPrimitiveTest, Default) { NonPrimitive s; StructArray defaultArray; @@ -114,7 +114,7 @@ TEST_F(NonPrimitiveStructTest, Default) { } // Test struct constructors -TEST_F(NonPrimitiveStructTest, Constructors) { +TEST_F(NonPrimitiveTest, Constructors) { // Member constructor NonPrimitive s1(testString, testEnum, testArray, testArray, testStruct, testStruct, testU32Arr, testStructArr); assertStructMembers(s1); @@ -141,7 +141,7 @@ TEST_F(NonPrimitiveStructTest, Constructors) { } // Test struct assignment operator -TEST_F(NonPrimitiveStructTest, AssignmentOp) { +TEST_F(NonPrimitiveTest, AssignmentOp) { NonPrimitive s1; NonPrimitive s2(testString, testEnum, testArray, testArray, testStruct, testStruct, testU32Arr, testStructArr); @@ -155,7 +155,7 @@ TEST_F(NonPrimitiveStructTest, AssignmentOp) { } // Test struct equality and inequality operators -TEST_F(NonPrimitiveStructTest, EqualityOp) { +TEST_F(NonPrimitiveTest, EqualityOp) { NonPrimitive s1, s2; ASSERT_TRUE(s1 == s2); @@ -204,7 +204,7 @@ TEST_F(NonPrimitiveStructTest, EqualityOp) { } // Test struct getter and setter functions -TEST_F(NonPrimitiveStructTest, GetterSetterFunctions) { +TEST_F(NonPrimitiveTest, GetterSetterFunctions) { NonPrimitive s1, s2; // Set all members @@ -240,7 +240,7 @@ TEST_F(NonPrimitiveStructTest, GetterSetterFunctions) { } // Test struct serialization and deserialization -TEST_F(NonPrimitiveStructTest, Serialization) { +TEST_F(NonPrimitiveTest, Serialization) { NonPrimitive s(testString, testEnum, testArray, testArray, testStruct, testStruct, testU32Arr, testStructArr); NonPrimitive sCopy; @@ -279,7 +279,7 @@ TEST_F(NonPrimitiveStructTest, Serialization) { } // Test struct toString() and ostream operator functions -TEST_F(NonPrimitiveStructTest, ToString) { +TEST_F(NonPrimitiveTest, ToString) { NonPrimitive s(testString, testEnum, testArray, testArray, testStruct, testStruct, testU32Arr, testStructArr); std::stringstream buf1, buf2; From 7de1eb236f9b757ea2d7c4b7e3bb820d547a10ad Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 23:46:41 -0800 Subject: [PATCH 16/30] Revise FppTest struct tests --- FppTestProject/FppTest/struct/PrimitiveTest.cpp | 4 +++- FppTestProject/FppTest/struct/primitive.fppi | 6 ++++++ FppTestProject/FppTest/struct/struct.fpp | 17 +++++++++++------ 3 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 FppTestProject/FppTest/struct/primitive.fppi diff --git a/FppTestProject/FppTest/struct/PrimitiveTest.cpp b/FppTestProject/FppTest/struct/PrimitiveTest.cpp index fc65300b3fc..9bbf5283787 100644 --- a/FppTestProject/FppTest/struct/PrimitiveTest.cpp +++ b/FppTestProject/FppTest/struct/PrimitiveTest.cpp @@ -6,7 +6,9 @@ #include +#include "FppTest/struct/C_PrimitiveSerializableAc.hpp" #include "FppTest/struct/PrimitiveSerializableAc.hpp" +#include "FppTest/struct/SM_SMPrimitiveAliasAc.hpp" #include "FppTest/utils/Utils.hpp" #include "Fw/Types/SerialBuffer.hpp" #include "Fw/Types/StringUtils.hpp" @@ -216,7 +218,7 @@ REGISTER_TYPED_TEST_SUITE_P(PrimitiveTest, SerializedSize, ToString); -using PrimitiveTestImplementations = ::testing::Types; +using PrimitiveTestImplementations = ::testing::Types; INSTANTIATE_TYPED_TEST_SUITE_P(FppTest, PrimitiveTest, PrimitiveTestImplementations); } // namespace Struct diff --git a/FppTestProject/FppTest/struct/primitive.fppi b/FppTestProject/FppTest/struct/primitive.fppi new file mode 100644 index 00000000000..da502d77af4 --- /dev/null +++ b/FppTestProject/FppTest/struct/primitive.fppi @@ -0,0 +1,6 @@ +struct Primitive { + mBool: bool + mU32: U32 + mI16: I16 + mF64: F64 +} diff --git a/FppTestProject/FppTest/struct/struct.fpp b/FppTestProject/FppTest/struct/struct.fpp index c023ffed51d..780cc75963f 100644 --- a/FppTestProject/FppTest/struct/struct.fpp +++ b/FppTestProject/FppTest/struct/struct.fpp @@ -6,12 +6,7 @@ module FppTest { array StructArray = [3] U32 type StructArrAlias = StructArray - struct Primitive { - mBool: bool - mU32: U32 - mI16: I16 - mF64: F64 - } + include "primitive.fppi" type StructSAlias = Primitive @@ -43,6 +38,16 @@ module FppTest { mStrAlias_2: [3] StructAliasString } + passive component C { + include "primitive.fppi" + } + + state machine SM { + state S + initial enter S + type SMPrimitive = Primitive + } + } } From 9d2ecd62edf9f60f7b363334c6a629ce1a514cd3 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 22 Jan 2026 23:50:37 -0800 Subject: [PATCH 17/30] Revise FppTest struct tests --- FppTestProject/FppTest/struct/PrimitiveTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FppTestProject/FppTest/struct/PrimitiveTest.cpp b/FppTestProject/FppTest/struct/PrimitiveTest.cpp index 9bbf5283787..40be917afbb 100644 --- a/FppTestProject/FppTest/struct/PrimitiveTest.cpp +++ b/FppTestProject/FppTest/struct/PrimitiveTest.cpp @@ -218,7 +218,7 @@ REGISTER_TYPED_TEST_SUITE_P(PrimitiveTest, SerializedSize, ToString); -using PrimitiveTestImplementations = ::testing::Types; +using PrimitiveTestImplementations = ::testing::Types; INSTANTIATE_TYPED_TEST_SUITE_P(FppTest, PrimitiveTest, PrimitiveTestImplementations); } // namespace Struct From 1cd38c5b6e61e0a4c8b60f6533b210406c6c48fb Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Tue, 27 Jan 2026 09:19:24 -0800 Subject: [PATCH 18/30] Update fpp version --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 60a238c1855..740eec3e9f3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ Flask-Compress==1.15 Flask-RESTful==0.3.10 fprime-fpl-layout==1.0.3 fprime-fpl-write-pic==1.0.3 -fprime-fpp==3.1.1a1-26-g925a23703 +fprime-fpp==3.1.1a2 fprime-gds==4.1.0 fprime-tools==4.1.0 fprime-visual==1.0.2 From 9cd8a2639897f0c088686725822a47077e2ae0dc Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Tue, 27 Jan 2026 09:21:48 -0800 Subject: [PATCH 19/30] Reformat code --- FppTestProject/FppTest/array/ArrayToStringTest.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/FppTestProject/FppTest/array/ArrayToStringTest.cpp b/FppTestProject/FppTest/array/ArrayToStringTest.cpp index e67488b47d9..de09324ca12 100644 --- a/FppTestProject/FppTest/array/ArrayToStringTest.cpp +++ b/FppTestProject/FppTest/array/ArrayToStringTest.cpp @@ -38,8 +38,7 @@ class ArrayToStringTest : public ::testing::Test { typename ArrayType::ElementType testVals[ArrayType::SIZE]; }; -using ArrayTypes = - ::testing::Types; +using ArrayTypes = ::testing::Types; TYPED_TEST_SUITE(ArrayToStringTest, ArrayTypes); // Test array toString() and ostream operator functions From abb3cdfda0629a1ce80465d088ad62ecac1e3d96 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Tue, 27 Jan 2026 09:31:12 -0800 Subject: [PATCH 20/30] Fix spelling --- .github/actions/spelling/expect.txt | 3 +++ FppTestProject/FppTest/array/main.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 1c6e176574e..f8f90f959d1 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -1,4 +1,5 @@ Aadil +AArray AClass ACTIVERATEGROUP ACTIVERATEGROUPCFG @@ -202,6 +203,7 @@ eabi eabihf eay ECLIPSEHELP +EEnum EHAs eip Elts @@ -720,6 +722,7 @@ tparam TPP trinomials tts +Tumbar typedef typedef'ed uart diff --git a/FppTestProject/FppTest/array/main.cpp b/FppTestProject/FppTest/array/main.cpp index f4b5cc20568..a5c4df09b2f 100644 --- a/FppTestProject/FppTest/array/main.cpp +++ b/FppTestProject/FppTest/array/main.cpp @@ -25,7 +25,7 @@ namespace FppTest { namespace Array { // ---------------------------------------------------------------------- -// Test instatiations +// Test instantiations // ---------------------------------------------------------------------- // Array tests From 87d25c72e631ee7a92406e92b913ba79760fe069 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Tue, 27 Jan 2026 10:47:11 -0800 Subject: [PATCH 21/30] Update fpp version --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 740eec3e9f3..6e86ba51dd4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ Flask-Compress==1.15 Flask-RESTful==0.3.10 fprime-fpl-layout==1.0.3 fprime-fpl-write-pic==1.0.3 -fprime-fpp==3.1.1a2 +fprime-fpp==3.1.1a3 fprime-gds==4.1.0 fprime-tools==4.1.0 fprime-visual==1.0.2 From f9b193e23a008262d57c882af51148ac570ccf09 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 29 Jan 2026 13:53:36 -0800 Subject: [PATCH 22/30] Fix bugs in FppTest These bugs were exposed by work on FPP #903 --- .../FppTest/array/ArrayToStringTest.cpp | 19 ++- FppTestProject/FppTest/array/FormatTest.cpp | 151 +++++++++--------- .../FppTest/struct/NonPrimitiveStructTest.cpp | 6 +- requirements.txt | 2 +- 4 files changed, 95 insertions(+), 83 deletions(-) diff --git a/FppTestProject/FppTest/array/ArrayToStringTest.cpp b/FppTestProject/FppTest/array/ArrayToStringTest.cpp index 0818f372b17..d4906d93b84 100644 --- a/FppTestProject/FppTest/array/ArrayToStringTest.cpp +++ b/FppTestProject/FppTest/array/ArrayToStringTest.cpp @@ -38,18 +38,23 @@ TYPED_TEST_SUITE(ArrayToStringTest, ArrayTypes); // Test array toString() and ostream operator functions TYPED_TEST(ArrayToStringTest, ToString) { TypeParam a(this->testVals); - std::stringstream buf1, buf2; + std::stringstream actual; + std::stringstream expected; - buf1 << a; + actual << a; - buf2 << "[ "; + Fw::String s; + s += "[ "; for (U32 i = 0; i < TypeParam::SIZE; i++) { if (i > 0) { - buf2 << ", "; + s += ", "; } - buf2 << this->testVals[i]; + Fw::String s1; + this->testVals[i].toString(s1); + s += s1; } - buf2 << " ]"; + s += " ]"; + expected << s; - ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); + ASSERT_STREQ(actual.str().c_str(), expected.str().c_str()); } diff --git a/FppTestProject/FppTest/array/FormatTest.cpp b/FppTestProject/FppTest/array/FormatTest.cpp index 4617fc2f03f..bfe6dde1a4b 100644 --- a/FppTestProject/FppTest/array/FormatTest.cpp +++ b/FppTestProject/FppTest/array/FormatTest.cpp @@ -34,201 +34,203 @@ // Tests FPP format strings class FormatTest : public ::testing::Test { protected: - void SetUp() override { buf2 << "[ "; } + void SetUp() override { expected << "[ "; } + + std::stringstream actual; + std::stringstream expected; - std::stringstream buf1, buf2; }; TEST_F(FormatTest, Bool) { bool testVals[FormatBool::SIZE] = {true, true, false}; FormatBool a(testVals); - buf1 << a; + actual << a; for (U32 i = 0; i < FormatBool::SIZE; i++) { if (i > 0) { - buf2 << ", "; + expected << ", "; } - buf2 << "a " << testVals[i] << " b"; + expected << "a " << testVals[i] << " b"; } - buf2 << " ]"; + expected << " ]"; - ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); + ASSERT_STREQ(actual.str().c_str(), expected.str().c_str()); } TEST_F(FormatTest, U8) { U8 testVals[FormatU8::SIZE] = {0, 100, std::numeric_limits::max()}; FormatU8 a(testVals); - buf1 << a; + actual << a; for (U32 i = 0; i < FormatU8::SIZE; i++) { if (i > 0) { - buf2 << ", "; + expected << ", "; } - buf2 << "a " << static_cast(testVals[i]) << " b"; + expected << "a " << static_cast(testVals[i]) << " b"; } - buf2 << " ]"; + expected << " ]"; - ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); + ASSERT_STREQ(actual.str().c_str(), expected.str().c_str()); } TEST_F(FormatTest, U16Dec) { U16 testVals[FormatU16Dec::SIZE] = {0, 100, std::numeric_limits::max()}; FormatU16Dec a(testVals); - buf1 << a; + actual << a; for (U32 i = 0; i < FormatU16Dec::SIZE; i++) { if (i > 0) { - buf2 << ", "; + expected << ", "; } - buf2 << "a " << std::dec << testVals[i] << " b"; + expected << "a " << std::dec << testVals[i] << " b"; } - buf2 << " ]"; + expected << " ]"; - ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); + ASSERT_STREQ(actual.str().c_str(), expected.str().c_str()); } TEST_F(FormatTest, U32Oct) { U32 testVals[FormatU32Oct::SIZE] = {0, 100, std::numeric_limits::max()}; FormatU32Oct a(testVals); - buf1 << a; + actual << a; for (U32 i = 0; i < FormatU32Oct::SIZE; i++) { if (i > 0) { - buf2 << ", "; + expected << ", "; } - buf2 << "a " << std::oct << testVals[i] << " b"; + expected << "a " << std::oct << testVals[i] << " b"; } - buf2 << " ]"; + expected << " ]"; - ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); + ASSERT_STREQ(actual.str().c_str(), expected.str().c_str()); } TEST_F(FormatTest, U64Hex) { U64 testVals[FormatU64Hex::SIZE] = {0, 100, std::numeric_limits::max()}; FormatU64Hex a(testVals); - buf1 << a; + actual << a; for (U32 i = 0; i < FormatU64Hex::SIZE; i++) { if (i > 0) { - buf2 << ", "; + expected << ", "; } - buf2 << "a " << std::hex << testVals[i] << " b"; + expected << "a " << std::hex << testVals[i] << " b"; } - buf2 << " ]"; + expected << " ]"; - ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); + ASSERT_STREQ(actual.str().c_str(), expected.str().c_str()); } TEST_F(FormatTest, I8) { I8 testVals[FormatI8::SIZE] = {std::numeric_limits::min(), 0, std::numeric_limits::max()}; FormatI8 a(testVals); - buf1 << a; + actual << a; for (U32 i = 0; i < FormatI8::SIZE; i++) { if (i > 0) { - buf2 << ", "; + expected << ", "; } - buf2 << "a " << static_cast(testVals[i]) << " b"; + expected << "a " << static_cast(testVals[i]) << " b"; } - buf2 << " ]"; + expected << " ]"; - ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); + ASSERT_STREQ(actual.str().c_str(), expected.str().c_str()); } TEST_F(FormatTest, I16Dec) { I16 testVals[FormatI16Dec::SIZE] = {std::numeric_limits::min(), 0, std::numeric_limits::max()}; FormatI16Dec a(testVals); - buf1 << a; + actual << a; for (U32 i = 0; i < FormatI16Dec::SIZE; i++) { if (i > 0) { - buf2 << ", "; + expected << ", "; } - buf2 << "a " << std::dec << testVals[i] << " b"; + expected << "a " << std::dec << testVals[i] << " b"; } - buf2 << " ]"; + expected << " ]"; - ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); + ASSERT_STREQ(actual.str().c_str(), expected.str().c_str()); } TEST_F(FormatTest, I32Oct) { I32 testVals[FormatI32Oct::SIZE] = {std::numeric_limits::min(), 0, std::numeric_limits::max()}; FormatI32Oct a(testVals); - buf1 << a; + actual << a; for (U32 i = 0; i < FormatI32Oct::SIZE; i++) { if (i > 0) { - buf2 << ", "; + expected << ", "; } - buf2 << "a " << std::oct << testVals[i] << " b"; + expected << "a " << std::oct << testVals[i] << " b"; } - buf2 << " ]"; + expected << " ]"; - ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); + ASSERT_STREQ(actual.str().c_str(), expected.str().c_str()); } TEST_F(FormatTest, I64Hex) { I64 testVals[FormatI64Hex::SIZE] = {std::numeric_limits::min(), 0, std::numeric_limits::max()}; FormatI64Hex a(testVals); - buf1 << a; + actual << a; for (U32 i = 0; i < FormatI64Hex::SIZE; i++) { if (i > 0) { - buf2 << ", "; + expected << ", "; } - buf2 << "a " << std::hex << testVals[i] << " b"; + expected << "a " << std::hex << testVals[i] << " b"; } - buf2 << " ]"; + expected << " ]"; - ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); + ASSERT_STREQ(actual.str().c_str(), expected.str().c_str()); } TEST_F(FormatTest, F32E) { F32 testVals[FormatF32e::SIZE] = {std::numeric_limits::min(), 0.0, std::numeric_limits::max()}; FormatF32e a(testVals); - buf1 << a; + actual << a; for (U32 i = 0; i < FormatF32e::SIZE; i++) { if (i > 0) { - buf2 << ", "; + expected << ", "; } - buf2 << "a " << std::setprecision(1) << std::scientific << testVals[i] << " b"; + expected << "a " << std::setprecision(1) << std::scientific << testVals[i] << " b"; } - buf2 << " ]"; + expected << " ]"; - ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); + ASSERT_STREQ(actual.str().c_str(), expected.str().c_str()); } TEST_F(FormatTest, F32F) { F32 testVals[FormatF32f::SIZE] = {std::numeric_limits::min(), 0.0, std::numeric_limits::max()}; FormatF32f a(testVals); - buf1 << a; + actual << a; for (U32 i = 0; i < FormatF32f::SIZE; i++) { if (i > 0) { - buf2 << ", "; + expected << ", "; } - buf2 << "a " << std::setprecision(2) << std::fixed << testVals[i] << " b"; + expected << "a " << std::setprecision(2) << std::fixed << testVals[i] << " b"; } - buf2 << " ]"; + expected << " ]"; - ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); + ASSERT_STREQ(actual.str().c_str(), expected.str().c_str()); } TEST_F(FormatTest, F64G) { F64 testVals[FormatF64g::SIZE] = {std::numeric_limits::min(), 0.0, std::numeric_limits::max()}; FormatF64g a(testVals); - buf1 << a; + actual << a; for (U32 i = 0; i < FormatF64g::SIZE; i++) { if (i > 0) { - buf2 << ", "; + expected << ", "; } - buf2 << "a " << std::setprecision(3) << testVals[i] << " b"; + expected << "a " << std::setprecision(3) << testVals[i] << " b"; } - buf2 << " ]"; + expected << " ]"; - ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); + ASSERT_STREQ(actual.str().c_str(), expected.str().c_str()); } TEST_F(FormatTest, String) { @@ -241,16 +243,21 @@ TEST_F(FormatTest, String) { FormatString a(testVals); - buf1 << a; + actual << a; + Fw::String s; + expected.str(""); + s += "[ "; for (U32 i = 0; i < FormatString::SIZE; i++) { if (i > 0) { - buf2 << ", "; + s += ", "; } - buf2 << "% " << testVals[i].toChar(); + s += "% "; + s += testVals[i].toChar(); } - buf2 << " ]"; + s += " ]"; + expected << s; - ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); + ASSERT_STREQ(actual.str().c_str(), expected.str().c_str()); } TEST_F(FormatTest, Char) { @@ -258,14 +265,14 @@ TEST_F(FormatTest, Char) { FppTest::Utils::getNonzeroU8()}; FormatChar a(testVals); - buf1 << a; + actual << a; for (U32 i = 0; i < FormatChar::SIZE; i++) { if (i > 0) { - buf2 << ", "; + expected << ", "; } - buf2 << "a " << testVals[i] << " b"; + expected << "a " << testVals[i] << " b"; } - buf2 << " ]"; + expected << " ]"; - ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); + ASSERT_STREQ(actual.str().c_str(), expected.str().c_str()); } diff --git a/FppTestProject/FppTest/struct/NonPrimitiveStructTest.cpp b/FppTestProject/FppTest/struct/NonPrimitiveStructTest.cpp index 76d5965faf6..bb1a28a7ce0 100644 --- a/FppTestProject/FppTest/struct/NonPrimitiveStructTest.cpp +++ b/FppTestProject/FppTest/struct/NonPrimitiveStructTest.cpp @@ -96,7 +96,7 @@ TEST_F(NonPrimitiveStructTest, Default) { Primitive defaultStruct2(true, 0, 0, 1.16); // Constants - ASSERT_EQ(NonPrimitive::SERIALIZED_SIZE, Fw::StringBase::STATIC_SERIALIZED_SIZE(80) + StructEnum::SERIALIZED_SIZE + + ASSERT_EQ(NonPrimitive::SERIALIZED_SIZE, Fw::String::SERIALIZED_SIZE + StructEnum::SERIALIZED_SIZE + StructArray::SERIALIZED_SIZE + StructArrAlias::SERIALIZED_SIZE + Primitive::SERIALIZED_SIZE + StructSAlias::SERIALIZED_SIZE + (3 * sizeof(U32)) + (3 * Primitive::SERIALIZED_SIZE)); @@ -247,8 +247,8 @@ TEST_F(NonPrimitiveStructTest, Serialization) { NonPrimitive sCopy; U32 stringSerializedSize = static_cast(testString.length() + sizeof(FwBuffSizeType)); - U32 serializedSize = static_cast(NonPrimitive::SERIALIZED_SIZE - Fw::StringBase::STATIC_SERIALIZED_SIZE(80) + - stringSerializedSize); + U32 serializedSize = + static_cast(NonPrimitive::SERIALIZED_SIZE - Fw::String::SERIALIZED_SIZE + stringSerializedSize); Fw::SerializeStatus status; // Test successful serialization diff --git a/requirements.txt b/requirements.txt index bfdfb5af9a8..c7c39293955 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ Flask-Compress==1.15 Flask-RESTful==0.3.10 fprime-fpl-layout==1.0.3 fprime-fpl-write-pic==1.0.3 -fprime-fpp==3.1.1a1 +fprime-fpp==3.1.1a3-15-g503fbd4a9 fprime-gds==4.1.0 fprime-tools==4.1.0 fprime-visual==1.0.2 From 6c72bd1615cc3a40bba5e67709ae47e95b446fbe Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 29 Jan 2026 14:02:05 -0800 Subject: [PATCH 23/30] Revise spelling of constants To conform to change in generated code --- Svc/FrameAccumulator/FrameDetector/CcsdsTcFrameDetector.hpp | 2 +- .../test/ut/detectors/CcsdsTcFrameDetectorTestMain.cpp | 2 +- Svc/PassiveRateGroup/test/ut/PassiveRateGroupTestMain.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Svc/FrameAccumulator/FrameDetector/CcsdsTcFrameDetector.hpp b/Svc/FrameAccumulator/FrameDetector/CcsdsTcFrameDetector.hpp index dd8e68ca01d..80fb3ce5c2b 100644 --- a/Svc/FrameAccumulator/FrameDetector/CcsdsTcFrameDetector.hpp +++ b/Svc/FrameAccumulator/FrameDetector/CcsdsTcFrameDetector.hpp @@ -43,7 +43,7 @@ class CcsdsTcFrameDetector : public FrameDetector { protected: //! \brief expected flags and spacecraft ID token for a valid CCSDS TC frame const U16 m_expectedFlagsAndScIdToken = - 0x1 << Ccsds::TCSubfields::BypassFlagOffset | (ComCfg::FppConstant_SpacecraftId::SpacecraftId); + 0x1 << Ccsds::TCSubfields::BypassFlagOffset | (ComCfg::SpacecraftId); }; // class CcsdsTcFrameDetector } // namespace FrameDetectors diff --git a/Svc/FrameAccumulator/test/ut/detectors/CcsdsTcFrameDetectorTestMain.cpp b/Svc/FrameAccumulator/test/ut/detectors/CcsdsTcFrameDetectorTestMain.cpp index 26ca8fcc74c..0ad339a059e 100644 --- a/Svc/FrameAccumulator/test/ut/detectors/CcsdsTcFrameDetectorTestMain.cpp +++ b/Svc/FrameAccumulator/test/ut/detectors/CcsdsTcFrameDetectorTestMain.cpp @@ -16,7 +16,7 @@ using namespace Svc::Ccsds; constexpr U32 CIRCULAR_BUFFER_TEST_SIZE = 2048; constexpr U16 EXPECTED_START_TOKEN = - 0x1 << TCSubfields::BypassFlagOffset | (ComCfg::FppConstant_SpacecraftId::SpacecraftId); + 0x1 << TCSubfields::BypassFlagOffset | (ComCfg::SpacecraftId); // Test fixture to set up the detector under test and circular buffer class CcsdsFrameDetectorTest : public ::testing::Test { diff --git a/Svc/PassiveRateGroup/test/ut/PassiveRateGroupTestMain.cpp b/Svc/PassiveRateGroup/test/ut/PassiveRateGroupTestMain.cpp index a1d76c6fbe0..970bacfeaa9 100644 --- a/Svc/PassiveRateGroup/test/ut/PassiveRateGroupTestMain.cpp +++ b/Svc/PassiveRateGroup/test/ut/PassiveRateGroupTestMain.cpp @@ -33,7 +33,7 @@ void connectPorts(Svc::PassiveRateGroup& impl, Svc::PassiveRateGroupTester& test TEST(PassiveRateGroupTest, NominalSchedule) { for (FwEnumStoreType inst = 0; inst < 3; inst++) { - U32 contexts[FppConstant_PassiveRateGroupOutputPorts::PassiveRateGroupOutputPorts] = {1, 2, 3, 4, 5}; + U32 contexts[PassiveRateGroupOutputPorts] = {1, 2, 3, 4, 5}; Svc::PassiveRateGroup impl("PassiveRateGroup"); impl.configure(contexts, FW_NUM_ARRAY_ELEMENTS(contexts)); From 34bb683bb57390ae79bb39ed2b6d6ec09c15b413 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 29 Jan 2026 14:41:02 -0800 Subject: [PATCH 24/30] Refactor array format test --- FppTestProject/FppTest/array/FormatTest.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/FppTestProject/FppTest/array/FormatTest.cpp b/FppTestProject/FppTest/array/FormatTest.cpp index c75b1f4103c..dcd3d833a59 100644 --- a/FppTestProject/FppTest/array/FormatTest.cpp +++ b/FppTestProject/FppTest/array/FormatTest.cpp @@ -248,20 +248,22 @@ TEST_F(FormatTest, String) { FormatString a(testVals); actual << a; - Fw::String s; - expected.str(""); - s += "[ "; + + // Construct the full expected string + std::stringstream expectedStream; + expectedStream << "[ "; for (U32 i = 0; i < FormatString::SIZE; i++) { if (i > 0) { - s += ", "; + expectedStream << ", "; } - s += "% "; - s += testVals[i].toChar(); + expectedStream << "% " << testVals[i]; } - s += " ]"; - expected << s; + expectedStream << " ]"; - ASSERT_STREQ(actual.str().c_str(), expected.str().c_str()); + // Handle F Prime string truncation + Fw::String expected(expectedStream.str().c_str()); + + ASSERT_STREQ(actual.str().c_str(), expected.toChar()); } TEST_F(FormatTest, Char) { From 3fe4b44a13c83a23d3b474fd83ed0358fecfcf85 Mon Sep 17 00:00:00 2001 From: "Robert L. Bocchino Jr." Date: Thu, 29 Jan 2026 15:57:22 -0800 Subject: [PATCH 25/30] Fix compiler warning in FppTest on gcc --- FppTestProject/FppTest/array/FormatTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FppTestProject/FppTest/array/FormatTest.cpp b/FppTestProject/FppTest/array/FormatTest.cpp index dcd3d833a59..af447878c88 100644 --- a/FppTestProject/FppTest/array/FormatTest.cpp +++ b/FppTestProject/FppTest/array/FormatTest.cpp @@ -261,9 +261,9 @@ TEST_F(FormatTest, String) { expectedStream << " ]"; // Handle F Prime string truncation - Fw::String expected(expectedStream.str().c_str()); + Fw::String expectedString(expectedStream.str().c_str()); - ASSERT_STREQ(actual.str().c_str(), expected.toChar()); + ASSERT_STREQ(actual.str().c_str(), expectedString.toChar()); } TEST_F(FormatTest, Char) { From 23c67cbfa535922436681ad33a81d9ba971f8987 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 29 Jan 2026 17:26:47 -0800 Subject: [PATCH 26/30] Revise FppTest --- .../internal/state/include/BasicString.fppi | 9 ++++++--- .../internal_instance/state/BasicStringTester.cpp | 2 +- requirements.txt | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/FppTestProject/FppTest/state_machine/internal/state/include/BasicString.fppi b/FppTestProject/FppTest/state_machine/internal/state/include/BasicString.fppi index df2b31dd056..24a7bd055d2 100644 --- a/FppTestProject/FppTest/state_machine/internal/state/include/BasicString.fppi +++ b/FppTestProject/FppTest/state_machine/internal/state/include/BasicString.fppi @@ -1,8 +1,8 @@ -constant basicStringSize = 80 - @ A basic state machine with string actions state machine BasicString { + constant stringSize = 80 + @ Action a action a @@ -10,7 +10,10 @@ state machine BasicString { action b: string @ Signal s - signal s: string + signal s: string size 200 + + @ Signal s1 + signal s1: string size 100 initial enter S diff --git a/FppTestProject/FppTest/state_machine/internal_instance/state/BasicStringTester.cpp b/FppTestProject/FppTest/state_machine/internal_instance/state/BasicStringTester.cpp index 225b63e8205..f5f1da3b3c6 100644 --- a/FppTestProject/FppTest/state_machine/internal_instance/state/BasicStringTester.cpp +++ b/FppTestProject/FppTest/state_machine/internal_instance/state/BasicStringTester.cpp @@ -51,7 +51,7 @@ void BasicStringTester::test() { ASSERT_EQ(this->smStateBasicString_getState(), SmState_BasicString::State::S); ASSERT_EQ(this->m_smStateBasicString_action_a_history.getSize(), 0); Fw::String value; - SmHarness::Pick::string(value, SmState::basicStringSize); + SmHarness::Pick::string(value, SmState::BasicString_stringSize); this->smStateBasicString_sendSignal_s(value); const auto status = this->doDispatch(); ASSERT_EQ(status, MSG_DISPATCH_OK); diff --git a/requirements.txt b/requirements.txt index c7c39293955..25ad5c06df6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ Flask-Compress==1.15 Flask-RESTful==0.3.10 fprime-fpl-layout==1.0.3 fprime-fpl-write-pic==1.0.3 -fprime-fpp==3.1.1a3-15-g503fbd4a9 +fprime-fpp==3.1.1a3-17-g229dd823a fprime-gds==4.1.0 fprime-tools==4.1.0 fprime-visual==1.0.2 From fd1e2b838244daf751b212651a9e38ea8ac5cf05 Mon Sep 17 00:00:00 2001 From: "Robert L. Bocchino Jr." Date: Thu, 29 Jan 2026 17:46:02 -0800 Subject: [PATCH 27/30] Update fpp version --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 25ad5c06df6..224184463fa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ Flask-Compress==1.15 Flask-RESTful==0.3.10 fprime-fpl-layout==1.0.3 fprime-fpl-write-pic==1.0.3 -fprime-fpp==3.1.1a3-17-g229dd823a +fprime-fpp==3.1.1a3-19-g1c811db22 fprime-gds==4.1.0 fprime-tools==4.1.0 fprime-visual==1.0.2 From 38e532d5f7e4cef5320463517979222ca9f8075b Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Fri, 30 Jan 2026 09:32:59 -0800 Subject: [PATCH 28/30] Update fpp version --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 224184463fa..d4d97c2b0b2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ Flask-Compress==1.15 Flask-RESTful==0.3.10 fprime-fpl-layout==1.0.3 fprime-fpl-write-pic==1.0.3 -fprime-fpp==3.1.1a3-19-g1c811db22 +fprime-fpp==3.1.1a4 fprime-gds==4.1.0 fprime-tools==4.1.0 fprime-visual==1.0.2 From ed890f42c8992bf92ac636258214f06113a379b4 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Fri, 30 Jan 2026 10:44:56 -0800 Subject: [PATCH 29/30] Fix DpDemo, CcsdsTcFrameDetector --- Ref/DpDemo/DpDemo.fpp | 12 +++++++----- .../FrameDetector/CcsdsTcFrameDetector.hpp | 3 +-- .../ut/detectors/CcsdsTcFrameDetectorTestMain.cpp | 3 +-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Ref/DpDemo/DpDemo.fpp b/Ref/DpDemo/DpDemo.fpp index 15a80e3d6e3..09ce3488b6d 100644 --- a/Ref/DpDemo/DpDemo.fpp +++ b/Ref/DpDemo/DpDemo.fpp @@ -2,6 +2,8 @@ module Ref { @ DP Demo active component DpDemo { + constant stringSize = 80 + enum ColorEnum { RED GREEN @@ -13,7 +15,7 @@ module Ref { ASYNC } - type StringAlias = string + type StringAlias = string size stringSize type BoolAlias = bool type I32Alias = I32 type F64Alias = F64 @@ -25,7 +27,7 @@ module Ref { array U32Array = [5] U32 @ Array of strings - array StringArray = [2] string + array StringArray = [2] string size stringSize @ Array of array of strings array ArrayOfStringArray = [3] StringArray @@ -43,14 +45,14 @@ module Ref { } struct StructWithStringMembers { - stringMember: string, + stringMember: string size stringSize, stringArrayMember: StringArray } struct StructWithEverything { integerMember: I32Alias, floatMember: F32, - stringMember: string, + stringMember: string size stringSize, booleanMember: bool, enumMember: ColorEnum, arrayMemberU32: [2] U32Array, @@ -188,7 +190,7 @@ module Ref { product record EnumArrayRecord: EnumArray id 9 @ Data product record - string array record - product record StringArrayRecord: string array id 10 + product record StringArrayRecord: string size stringSize array id 10 @ Data product record - array record (structs) product record StructArrayRecord: StructWithStringMembers array id 11 diff --git a/Svc/FrameAccumulator/FrameDetector/CcsdsTcFrameDetector.hpp b/Svc/FrameAccumulator/FrameDetector/CcsdsTcFrameDetector.hpp index 80fb3ce5c2b..7d9bbb898b3 100644 --- a/Svc/FrameAccumulator/FrameDetector/CcsdsTcFrameDetector.hpp +++ b/Svc/FrameAccumulator/FrameDetector/CcsdsTcFrameDetector.hpp @@ -42,8 +42,7 @@ class CcsdsTcFrameDetector : public FrameDetector { protected: //! \brief expected flags and spacecraft ID token for a valid CCSDS TC frame - const U16 m_expectedFlagsAndScIdToken = - 0x1 << Ccsds::TCSubfields::BypassFlagOffset | (ComCfg::SpacecraftId); + const U16 m_expectedFlagsAndScIdToken = (0x1 << Ccsds::TCSubfields::BypassFlagOffset) | (ComCfg::SpacecraftId); }; // class CcsdsTcFrameDetector } // namespace FrameDetectors diff --git a/Svc/FrameAccumulator/test/ut/detectors/CcsdsTcFrameDetectorTestMain.cpp b/Svc/FrameAccumulator/test/ut/detectors/CcsdsTcFrameDetectorTestMain.cpp index 0ad339a059e..6b91a924e6f 100644 --- a/Svc/FrameAccumulator/test/ut/detectors/CcsdsTcFrameDetectorTestMain.cpp +++ b/Svc/FrameAccumulator/test/ut/detectors/CcsdsTcFrameDetectorTestMain.cpp @@ -15,8 +15,7 @@ using namespace Svc::Ccsds; constexpr U32 CIRCULAR_BUFFER_TEST_SIZE = 2048; -constexpr U16 EXPECTED_START_TOKEN = - 0x1 << TCSubfields::BypassFlagOffset | (ComCfg::SpacecraftId); +constexpr U16 EXPECTED_START_TOKEN = (0x1 << TCSubfields::BypassFlagOffset) | (ComCfg::SpacecraftId); // Test fixture to set up the detector under test and circular buffer class CcsdsFrameDetectorTest : public ::testing::Test { From eead44737dc9f78a9685dbb2b597f4ead419b2aa Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Fri, 30 Jan 2026 10:50:19 -0800 Subject: [PATCH 30/30] Fix formatting --- FppTestProject/FppTest/array/FormatTest.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/FppTestProject/FppTest/array/FormatTest.cpp b/FppTestProject/FppTest/array/FormatTest.cpp index af447878c88..b4b0c5421ba 100644 --- a/FppTestProject/FppTest/array/FormatTest.cpp +++ b/FppTestProject/FppTest/array/FormatTest.cpp @@ -42,7 +42,6 @@ class FormatTest : public ::testing::Test { std::stringstream actual; std::stringstream expected; - }; TEST_F(FormatTest, Bool) {