Skip to content

Commit

Permalink
Revise fpp-to-xml component unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bocchino committed Jun 20, 2023
1 parent 5936681 commit f1f61f0
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
TypesComponentAi.xml
Generated by fpp-to-xml
====================================================================== -->
<component name="Types" kind="passive">
<component namespace="M" name="Types" kind="passive">

<import_array_type>Types_AArrayAi.xml</import_array_type>
<import_enum_type>Types_EEnumAi.xml</import_enum_type>
<import_serializable_type>Types_SSerializableAi.xml</import_serializable_type>
<include_header>Types_T.hpp</include_header>

</component>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Types_AArrayAi.xml
Generated by fpp-to-xml
====================================================================== -->
<array name="Types_A">
<array namespace="M" name="Types_A">
<type>U32</type>
<size>3</size>
<format>%u</format>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
Types_AUseArrayAi.xml
Generated by fpp-to-xml
====================================================================== -->
<array name="Types_AUse">
<array namespace="M" name="Types_AUse">
<import_array_type>Types_AArrayAi.xml</import_array_type>
<type>Types_A</type>
<type>M::Types_A</type>
<size>3</size>
<format>%s</format>
<default>
<value>Types_A(0, 0, 0)</value>
<value>Types_A(0, 0, 0)</value>
<value>Types_A(0, 0, 0)</value>
<value>M::Types_A(0, 0, 0)</value>
<value>M::Types_A(0, 0, 0)</value>
<value>M::Types_A(0, 0, 0)</value>
</default>
</array>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
Types_EEnumAi.xml
Generated by fpp-to-xml
====================================================================== -->
<enum name="Types_E" serialize_type="I32" default="X">
<enum namespace="M" name="Types_E" serialize_type="I32" default="X">
<item name="X" value="0"/>
</enum>
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
Types_EUseArrayAi.xml
Generated by fpp-to-xml
====================================================================== -->
<array name="Types_EUse">
<array namespace="M" name="Types_EUse">
<import_enum_type>Types_EEnumAi.xml</import_enum_type>
<type>Types_E</type>
<type>M::Types_E</type>
<size>3</size>
<format>%s</format>
<default>
<value>Types_E::X</value>
<value>Types_E::X</value>
<value>Types_E::X</value>
<value>M::Types_E::X</value>
<value>M::Types_E::X</value>
<value>M::Types_E::X</value>
</default>
</array>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Types_SSerializableAi.xml
Generated by fpp-to-xml
====================================================================== -->
<serializable name="Types_S">
<serializable namespace="M" name="Types_S">
<members>
<member name="x" type="U32" format="%u">
<default>0</default>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
Types_SUseArrayAi.xml
Generated by fpp-to-xml
====================================================================== -->
<array name="Types_SUse">
<array namespace="M" name="Types_SUse">
<import_serializable_type>Types_SSerializableAi.xml</import_serializable_type>
<type>Types_S</type>
<type>M::Types_S</type>
<size>3</size>
<format>%s</format>
<default>
<value>Types_S(0, 0.0f)</value>
<value>Types_S(0, 0.0f)</value>
<value>Types_S(0, 0.0f)</value>
<value>M::Types_S(0, 0.0f)</value>
<value>M::Types_S(0, 0.0f)</value>
<value>M::Types_S(0, 0.0f)</value>
</default>
</array>
4 changes: 4 additions & 0 deletions compiler/tools/fpp-to-xml/test/component/Types_T.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include "Fw/Types/Serializable.hpp"

namespace M {

//! C++ interface for type Types_T
//! This simulates a handwritten C++ serializable class
//! that is represented as an abstract type in an FPP model.
Expand Down Expand Up @@ -31,4 +33,6 @@ class Types_T :

};

}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
Types_TUseArrayAi.xml
Generated by fpp-to-xml
====================================================================== -->
<array name="Types_TUse">
<array namespace="M" name="Types_TUse">
<include_header>Types_T.hpp</include_header>
<type>Types_T</type>
<type>M::Types_T</type>
<size>3</size>
<format>%s</format>
<default>
<value>Types_T()</value>
<value>Types_T()</value>
<value>Types_T()</value>
<value>M::Types_T()</value>
<value>M::Types_T()</value>
<value>M::Types_T()</value>
</default>
</array>
12 changes: 0 additions & 12 deletions compiler/tools/fpp-to-xml/test/component/check-xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
export COMPILER_ROOT=$PWD/../../../..

skip_xml_names="
Types_AArray
Types_AUseArray
Types_EEnum
Types_EUseArray
Types_SUseArray
Types_TUseArray
"

for name in $skip_xml_names
Expand All @@ -21,12 +15,6 @@ CommandsComponent
EventsComponent
ParametersComponent
TelemetryComponent
Types_AArray
Types_AUseArray
Types_EEnum
Types_EUseArray
Types_SUseArray
Types_TUseArray
"

for name in $skip_cpp_names
Expand Down
24 changes: 14 additions & 10 deletions compiler/tools/fpp-to-xml/test/component/types.fpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
passive component Types {
module M {

array A = [3] U32
passive component Types {

enum E { X }
array A = [3] U32

struct S { x: U32, y: F32 }
enum E { X }

type T
struct S { x: U32, y: F32 }

}
type T

array AUse = [3] Types.A
array EUse = [3] Types.E
array SUse = [3] Types.S
array TUse = [3] Types.T

array Types_AUse = [3] Types.A
array Types_EUse = [3] Types.E
array Types_SUse = [3] Types.S
array Types_TUse = [3] Types.T
}

}

0 comments on commit f1f61f0

Please sign in to comment.