Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
726b434
Revise FppTest
bocchino Jan 23, 2026
1b84f07
Revise FppTest array tests
bocchino Jan 23, 2026
103f47f
Add missing file
bocchino Jan 23, 2026
7536d1f
Revise FppTest array tests
bocchino Jan 23, 2026
03eb238
Refactor FppTest enum tests
bocchino Jan 23, 2026
4105e48
Add comment
bocchino Jan 23, 2026
c965650
Revise FppTest enum tests
bocchino Jan 23, 2026
7123de4
Revise FppTest array tests
bocchino Jan 23, 2026
d8690b3
Refactor FppTest enum tests
bocchino Jan 23, 2026
556965d
Refactor FppTest array tests
bocchino Jan 23, 2026
eaeeaca
Refactor FppTest enum tests
bocchino Jan 23, 2026
7b0915c
Revise FppTest enum tests
bocchino Jan 23, 2026
8eb9f6b
Refactor FppTest struct tests
bocchino Jan 23, 2026
963e9a2
Revise FppTest struct tests
bocchino Jan 23, 2026
e400c1b
Refactor FppTest struct tests
bocchino Jan 23, 2026
7de1eb2
Revise FppTest struct tests
bocchino Jan 23, 2026
9d2ecd6
Revise FppTest struct tests
bocchino Jan 23, 2026
1cd38c5
Update fpp version
bocchino Jan 27, 2026
9cd8a26
Reformat code
bocchino Jan 27, 2026
abb3cdf
Fix spelling
bocchino Jan 27, 2026
daa10ab
Merge branch 'devel' into fpp-issue-617-type-defs-in-state-machines
bocchino Jan 27, 2026
87d25c7
Update fpp version
bocchino Jan 27, 2026
f9b193e
Fix bugs in FppTest
bocchino Jan 29, 2026
6c72bd1
Revise spelling of constants
bocchino Jan 29, 2026
08b7643
Merge branch 'fpp-issue-617-type-defs-in-state-machines' into fpp-iss…
bocchino Jan 29, 2026
34bb683
Refactor array format test
bocchino Jan 29, 2026
3fe4b44
Fix compiler warning in FppTest on gcc
bocchino Jan 29, 2026
23c67cb
Revise FppTest
bocchino Jan 30, 2026
fd1e2b8
Update fpp version
bocchino Jan 30, 2026
38e532d
Update fpp version
bocchino Jan 30, 2026
9fc0bc3
Merge branch 'devel' into fpp-issue-617-type-defs-in-state-machines
bocchino Jan 30, 2026
ac5a72b
Merge branch 'fpp-issue-617-type-defs-in-state-machines' into fpp-iss…
bocchino Jan 30, 2026
ed890f4
Fix DpDemo, CcsdsTcFrameDetector
bocchino Jan 30, 2026
eead447
Fix formatting
bocchino Jan 30, 2026
c93df75
Merge branch 'devel' into fpp-issue-903-default-string-size
bocchino Feb 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions FppTestProject/FppTest/array/ArrayToStringTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,25 @@ 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 actualStream;
std::stringstream expectedStream;

buf1 << a;
actualStream << a;

buf2 << "[ ";
// Construct the full expected string
expectedStream << "[ ";
for (U32 i = 0; i < TypeParam::SIZE; i++) {
if (i > 0) {
buf2 << ", ";
expectedStream << ", ";
}
buf2 << this->testVals[i];
expectedStream << this->testVals[i];
}
buf2 << " ]";
expectedStream << " ]";

ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
// Handle F Prime string truncation
Fw::String expected(expectedStream.str().c_str());

ASSERT_STREQ(actualStream.str().c_str(), expected.toChar());
}

} // namespace Array
Expand Down
152 changes: 80 additions & 72 deletions FppTestProject/FppTest/array/FormatTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,201 +38,202 @@ namespace Array {
// Tests FPP format strings
class FormatTest : public ::testing::Test {
protected:
void SetUp() override { buf2 << "[ "; }
void SetUp() override { expected << "[ "; }

std::stringstream buf1, buf2;
std::stringstream actual;
std::stringstream expected;
};

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<U8>::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<U16>(testVals[i]) << " b";
expected << "a " << static_cast<U16>(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<U16>::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<U32>::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<U64>::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<I8>::min(), 0, std::numeric_limits<I8>::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<I16>(testVals[i]) << " b";
expected << "a " << static_cast<I16>(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<I16>::min(), 0, std::numeric_limits<I16>::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<I32>::min(), 0, std::numeric_limits<I32>::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<I64>::min(), 0, std::numeric_limits<I64>::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<F32>::min(), 0.0, std::numeric_limits<F32>::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<F32>::min(), 0.0, std::numeric_limits<F32>::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<F64>::min(), 0.0, std::numeric_limits<F64>::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) {
Expand All @@ -245,33 +246,40 @@ TEST_F(FormatTest, String) {

FormatString a(testVals);

buf1 << a;
actual << a;

// Construct the full expected string
std::stringstream expectedStream;
expectedStream << "[ ";
for (U32 i = 0; i < FormatString::SIZE; i++) {
if (i > 0) {
buf2 << ", ";
expectedStream << ", ";
}
buf2 << "% " << testVals[i].toChar();
expectedStream << "% " << testVals[i];
}
buf2 << " ]";
expectedStream << " ]";

// Handle F Prime string truncation
Fw::String expectedString(expectedStream.str().c_str());

ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
ASSERT_STREQ(actual.str().c_str(), expectedString.toChar());
}

TEST_F(FormatTest, Char) {
U8 testVals[FormatChar::SIZE] = {FppTest::Utils::getNonzeroU8(), FppTest::Utils::getNonzeroU8(),
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());
}

} // namespace Array
Expand Down
2 changes: 1 addition & 1 deletion FppTestProject/FppTest/component/tests/EventTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void Tester ::testEvent(FwIndexType portNum, FppTest::Types::LogStringParams& da

ASSERT_EVENTS_SIZE(1);
ASSERT_EVENTS_EventString_SIZE(1);
Fw::StringTemplate<80> arg1(data.args.val1);
Fw::String arg1(data.args.val1);
Fw::StringTemplate<100> arg2(data.args.val2);
ASSERT_EVENTS_EventString(static_cast<U32>(portNum), arg1.toChar(), arg2.toChar());

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
constant basicStringSize = 80

@ A basic state machine with string actions
state machine BasicString {

constant stringSize = 80

@ Action a
action a

@ Action b
action b: string

@ Signal s
signal s: string
signal s: string size 200

@ Signal s1
signal s1: string size 100

initial enter S

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading
Loading