Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FPP to v2.1.0a11 #2745

Merged
merged 5 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
26 changes: 13 additions & 13 deletions FppTest/array/FormatTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
// ======================================================================

#include "FppTest/array/FormatBoolArrayAc.hpp"
#include "FppTest/array/FormatU8ArrayAc.hpp"
#include "FppTest/array/FormatU16DecArrayAc.hpp"
#include "FppTest/array/FormatU32OctArrayAc.hpp"
#include "FppTest/array/FormatU64HexArrayAc.hpp"
#include "FppTest/array/FormatI8ArrayAc.hpp"
#include "FppTest/array/FormatI16DecArrayAc.hpp"
#include "FppTest/array/FormatI32OctArrayAc.hpp"
#include "FppTest/array/FormatI64HexArrayAc.hpp"
#include "FppTest/array/FormatCharArrayAc.hpp"
#include "FppTest/array/FormatF32eArrayAc.hpp"
#include "FppTest/array/FormatF32fArrayAc.hpp"
#include "FppTest/array/FormatF64gArrayAc.hpp"
#include "FppTest/array/FormatI16DecArrayAc.hpp"
#include "FppTest/array/FormatI32OctArrayAc.hpp"
#include "FppTest/array/FormatI64HexArrayAc.hpp"
#include "FppTest/array/FormatI8ArrayAc.hpp"
#include "FppTest/array/FormatStringArrayAc.hpp"
#include "FppTest/array/FormatCharArrayAc.hpp"
#include "FppTest/array/FormatU16DecArrayAc.hpp"
#include "FppTest/array/FormatU32OctArrayAc.hpp"
#include "FppTest/array/FormatU64HexArrayAc.hpp"
#include "FppTest/array/FormatU8ArrayAc.hpp"
#include "FppTest/utils/Utils.hpp"

#include "gtest/gtest.h"
Expand Down Expand Up @@ -243,11 +243,11 @@ TEST_F(FormatTest, F64G) {
}

TEST_F(FormatTest, String) {
FormatString::StringSize80 testVals[FormatString::SIZE];
char buf[80];
Fw::ExternalString testVals[FormatString::SIZE];
char buf[FormatString::SIZE][FormatString::ELEMENT_BUFFER_SIZE];
for (U32 i = 0; i < FormatString::SIZE; i++) {
FppTest::Utils::setString(buf, sizeof(buf));
testVals[i] = buf;
testVals[i].setBuffer(&buf[i][0], sizeof buf[i]);
FppTest::Utils::setString(&buf[i][0], sizeof buf[i]);
}

FormatString a(testVals);
Expand Down
6 changes: 3 additions & 3 deletions FppTest/array/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

This directory contains unit tests for the FPP array code generator.

* ArrayToStringTest: Tests array toString() and ostream operator functions
* FormatTest: Tests FPP format strings
* `ArrayToStringTest`: Tests array `toString()` and `ostream` operator functions
* `FormatTest`: Tests FPP format strings

To use this directory, you must have installed F Prime, and you must be inside
the F Prime Python virtual environment.

* To build the tests, run `fprime-util build --ut`.
* To run the tests, run `fprime-util check`.
* To run the tests, run `fprime-util check`.
41 changes: 24 additions & 17 deletions FppTest/array/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
#include "FppTest/array/StringArrayAc.hpp"
#include "FppTest/array/StructArrayAc.hpp"
#include "FppTest/array/Uint32ArrayArrayAc.hpp"
#include "FppTest/array/String100ArrayAc.hpp"

#include "FppTest/typed_tests/ArrayTest.hpp"
#include "FppTest/typed_tests/StringTest.hpp"
#include "FppTest/utils/Utils.hpp"

#include "Fw/Types/ExternalString.hpp"
#include "Fw/Types/StringTemplate.hpp"
#include "STest/Random/Random.hpp"
#include "gtest/gtest.h"

Expand Down Expand Up @@ -56,13 +55,26 @@ void FppTest::Array::setTestVals<Enum>(E (&a)[Enum::SIZE]) {
}
}

static char stringDefaultValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE];

template<>
void FppTest::Array::setDefaultVals<String>
(Fw::ExternalString (&a)[::String::SIZE]) {
for (U32 i = 0; i < ::String::SIZE; i++) {
char *const buffer = &stringDefaultValsBuffer[i][0];
a[i].setBuffer(buffer, ::String::ELEMENT_BUFFER_SIZE);
}
}

static char stringTestValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE];

template<>
void FppTest::Array::setTestVals<String>
(::String::StringSize80 (&a)[::String::SIZE]) {
char buf[80];
(Fw::ExternalString (&a)[::String::SIZE]) {
for (U32 i = 0; i < ::String::SIZE; i++) {
FppTest::Utils::setString(buf, sizeof(buf));
a[i] = buf;
char *const buffer = &stringTestValsBuffer[i][0];
a[i].setBuffer(buffer, ::String::ELEMENT_BUFFER_SIZE);
FppTest::Utils::setString(buffer, ::String::ELEMENT_BUFFER_SIZE, 1);
}
}

Expand Down Expand Up @@ -97,7 +109,7 @@ Enum FppTest::Array::getMultiElementConstructedArray<Enum>

template<>
::String FppTest::Array::getMultiElementConstructedArray<::String>
(::String::StringSize80 (&a)[::String::SIZE]) {
(Fw::ExternalString (&a)[::String::SIZE]) {
return ::String(a[0], a[1], a[2]);
}

Expand All @@ -116,28 +128,23 @@ Uint32Array FppTest::Array::getMultiElementConstructedArray<Uint32Array>
// Specializations for serialized size
template <>
U32 FppTest::Array::getSerializedSize<::String>
(::String::StringSize80 (&a)[::String::SIZE]) {
(Fw::ExternalString (&a)[::String::SIZE]) {
U32 serializedSize = 0;

for (U32 i = 0; i < ::String::SIZE; i++) {
serializedSize += a[i].length() + sizeof(FwBuffSizeType);
serializedSize += a[i].serializedSize();
}

return serializedSize;
}

// Instantiate string tests for arrays
using StringTestImplementations = ::testing::Types<
String::StringSize80,
String100::StringSize100
Fw::StringTemplate<80>,
Fw::StringTemplate<100>
>;
INSTANTIATE_TYPED_TEST_SUITE_P(Array, StringTest, StringTestImplementations);

template<>
U32 FppTest::String::getSize<String100::StringSize100>() {
return 100;
}

int main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
STest::Random::seed();
Expand Down
2 changes: 0 additions & 2 deletions FppTest/array/string.fpp
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
array String = [3] string

array String100 = [3] string size 100
9 changes: 9 additions & 0 deletions FppTest/component/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,14 @@ This directory contains unit tests for the FPP component code generator.
To use this directory, you must have installed F Prime, and you must be inside
the F Prime Python virtual environment.

The following subdirectories contain tests that you can run:

* `active`: Active component tests
* `passive`: Passive component tests
* `queued`: Queued component tests
* `empty`: Basic tests of an empty component

In any of these directories, you can do the following:

* To build the tests, run `fprime-util build --ut`.
* To run the tests, run `fprime-util check`.
24 changes: 12 additions & 12 deletions FppTest/component/active/ActiveTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@
void ActiveTest ::
stringArgsAsync_handler(
const NATIVE_INT_TYPE portNum,
const str80String &str80,
str80RefString &str80Ref,
const str100String &str100,
str100RefString &str100Ref
const Fw::StringBase &str80,
Fw::StringBase &str80Ref,
const Fw::StringBase &str100,
Fw::StringBase &str100Ref
)
{
this->stringArgsOut_out(
Expand Down Expand Up @@ -332,10 +332,10 @@
void ActiveTest ::
stringArgsGuarded_handler(
const NATIVE_INT_TYPE portNum,
const str80String &str80,
str80RefString &str80Ref,
const str100String &str100,
str100RefString &str100Ref
const Fw::StringBase &str80,
Fw::StringBase &str80Ref,
const Fw::StringBase &str100,
Fw::StringBase &str100Ref
)
{
this->stringArgsOut_out(
Expand All @@ -350,10 +350,10 @@
void ActiveTest ::
stringArgsSync_handler(
const NATIVE_INT_TYPE portNum,
const str80String &str80,
str80RefString &str80Ref,
const str100String &str100,
str100RefString &str100Ref
const Fw::StringBase &str80,
Fw::StringBase &str80Ref,
const Fw::StringBase &str100,
Fw::StringBase &str100Ref
)
{
this->stringArgsOut_out(
Expand Down
24 changes: 12 additions & 12 deletions FppTest/component/active/ActiveTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,28 +203,28 @@ class ActiveTest :
//! Handler implementation for stringArgsAsync
void stringArgsAsync_handler(
NATIVE_INT_TYPE portNum, //!< The port number
const StringArgsPortStrings::StringSize80& str80, //!< A string of size 80
StringArgsPortStrings::StringSize80& str80Ref,
const StringArgsPortStrings::StringSize100& str100, //!< A string of size 100
StringArgsPortStrings::StringSize100& str100Ref
const Fw::StringBase& str80, //!< A string of size 80
Fw::StringBase& str80Ref,
const Fw::StringBase& str100, //!< A string of size 100
Fw::StringBase& str100Ref
);

//! Handler implementation for stringArgsGuarded
void stringArgsGuarded_handler(
NATIVE_INT_TYPE portNum, //!< The port number
const StringArgsPortStrings::StringSize80& str80, //!< A string of size 80
StringArgsPortStrings::StringSize80& str80Ref,
const StringArgsPortStrings::StringSize100& str100, //!< A string of size 100
StringArgsPortStrings::StringSize100& str100Ref
const Fw::StringBase& str80, //!< A string of size 80
Fw::StringBase& str80Ref,
const Fw::StringBase& str100, //!< A string of size 100
Fw::StringBase& str100Ref
);

//! Handler implementation for stringArgsSync
void stringArgsSync_handler(
NATIVE_INT_TYPE portNum, //!< The port number
const StringArgsPortStrings::StringSize80& str80, //!< A string of size 80
StringArgsPortStrings::StringSize80& str80Ref,
const StringArgsPortStrings::StringSize100& str100, //!< A string of size 100
StringArgsPortStrings::StringSize100& str100Ref
const Fw::StringBase& str80, //!< A string of size 80
Fw::StringBase& str80Ref,
const Fw::StringBase& str100, //!< A string of size 100
Fw::StringBase& str100Ref
);

//! Handler implementation for structArgsAsync
Expand Down
38 changes: 13 additions & 25 deletions FppTest/component/active/test/ut/Tester.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Tester : public ActiveTestGTestBase {
FormalParamArray& aRef /*!<
An array ref
*/
);
) final;

//! Handler for from_arrayReturnOut
//!
Expand All @@ -87,7 +87,7 @@ class Tester : public ActiveTestGTestBase {
FormalParamArray& aRef /*!<
An array ref
*/
);
) final;

//! Handler for from_enumArgsOut
//!
Expand All @@ -98,7 +98,7 @@ class Tester : public ActiveTestGTestBase {
FormalParamEnum& enRef /*!<
An enum ref
*/
);
) final;

//! Handler for from_enumReturnOut
//!
Expand All @@ -109,17 +109,17 @@ class Tester : public ActiveTestGTestBase {
FormalParamEnum& enRef /*!<
An enum ref
*/
);
) final;

//! Handler for from_noArgsOut
//!
void from_noArgsOut_handler(const NATIVE_INT_TYPE portNum /*!< The port number*/
);
) final;

//! Handler for from_noArgsReturnOut
//!
bool from_noArgsReturnOut_handler(const NATIVE_INT_TYPE portNum /*!< The port number*/
);
) final;

//! Handler for from_primitiveArgsOut
//!
Expand All @@ -129,7 +129,7 @@ class Tester : public ActiveTestGTestBase {
F32 f32,
F32& f32Ref,
bool b,
bool& bRef);
bool& bRef) final;

//! Handler for from_primitiveReturnOut
//!
Expand All @@ -139,7 +139,7 @@ class Tester : public ActiveTestGTestBase {
F32 f32,
F32& f32Ref,
bool b,
bool& bRef);
bool& bRef) final;

//! Handler for from_prmGetIn
//!
Expand All @@ -150,7 +150,7 @@ class Tester : public ActiveTestGTestBase {
Fw::ParamBuffer& val /*!<
Buffer containing serialized parameter value
*/
);
) final;

//! Handler for from_prmGetIn
//!
Expand All @@ -161,19 +161,7 @@ class Tester : public ActiveTestGTestBase {
Fw::ParamBuffer& val /*!<
Buffer containing serialized parameter value
*/
);

//! Handler for from_stringArgsOut
//!
void from_stringArgsOut_handler(const NATIVE_INT_TYPE portNum, /*!< The port number*/
const str80String& str80, /*!<
A string of size 80
*/
str80RefString& str80Ref,
const str100String& str100, /*!<
A string of size 100
*/
str100RefString& str100Ref);
) final;

//! Handler for from_structArgsOut
//!
Expand All @@ -184,7 +172,7 @@ class Tester : public ActiveTestGTestBase {
FormalParamStruct& sRef /*!<
A struct ref
*/
);
) final;

//! Handler for from_structReturnOut
//!
Expand All @@ -195,7 +183,7 @@ class Tester : public ActiveTestGTestBase {
FormalParamStruct& sRef /*!<
A struct ref
*/
);
) final;

PRIVATE:
// ----------------------------------------------------------------------
Expand All @@ -206,7 +194,7 @@ class Tester : public ActiveTestGTestBase {
//!
void from_serialOut_handler(NATIVE_INT_TYPE portNum, /*!< The port number*/
Fw::SerializeBufferBase& Buffer /*!< The serialization buffer*/
);
) final;

public:
// ----------------------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions FppTest/component/passive/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FppTest_component_passive_ut_exe
cached
seed
seed-history
show-rules
Loading
Loading