PX4 Firmware
PX4 Autopilot Software http://px4.io
ParameterTest Class Reference
Inheritance diagram for ParameterTest:
Collaboration diagram for ParameterTest:

Public Member Functions

void SetUp () override
 
virtual bool run_tests ()
 Override to run your unit tests. More...
 
 ParameterTest ()
 
- Public Member Functions inherited from UnitTest
 UnitTest ()=default
 
virtual ~UnitTest ()=default
 
void print_results ()
 Prints results from running of unit tests. More...
 

Private Member Functions

bool _assert_parameter_int_value (param_t param, int32_t expected)
 
bool _assert_parameter_float_value (param_t param, float expected)
 
bool _set_all_int_parameters_to (int32_t value)
 
bool SimpleFind ()
 
bool ResetAll ()
 
bool ResetAllExcludesOne ()
 
bool ResetAllExcludesTwo ()
 
bool ResetAllExcludesBoundaryCheck ()
 
bool ResetAllExcludesWildcard ()
 
bool exportImport ()
 
bool exportImportAll ()
 

Private Attributes

param_t p0 {PARAM_INVALID}
 
param_t p1 {PARAM_INVALID}
 
param_t p2 {PARAM_INVALID}
 
param_t p3 {PARAM_INVALID}
 
param_t p4 {PARAM_INVALID}
 

Additional Inherited Members

- Protected Member Functions inherited from UnitTest
virtual void _init (void)
 Run before each unit test. Override to provide custom behavior. More...
 
virtual void _cleanup (void)
 Run after each unit test. Override to provide custom behavior. More...
 
void _print_assert (const char *msg, const char *test, const char *file, int line)
 
void _print_compare (const char *msg, const char *v1_text, int v1, const char *v2_text, int v2, const char *file, int line)
 
- Protected Attributes inherited from UnitTest
int _tests_run {0}
 The number of individual unit tests run. More...
 
int _tests_failed {0}
 The number of unit tests which failed. More...
 
int _tests_passed {0}
 The number of unit tests which passed. More...
 
int _assertions {0}
 Total number of assertions tested by all unit tests. More...
 

Detailed Description

Definition at line 41 of file ParameterTest.cpp.

Constructor & Destructor Documentation

◆ ParameterTest()

ParameterTest::ParameterTest ( )
inline

Definition at line 54 of file test_parameters.cpp.

References p0, p1, p2, p3, p4, and param_find().

Here is the call graph for this function:

Member Function Documentation

◆ _assert_parameter_float_value()

bool ParameterTest::_assert_parameter_float_value ( param_t  param,
float  expected 
)
private

Definition at line 100 of file test_parameters.cpp.

References param_get(), ut_compare, and ut_compare_float.

Here is the call graph for this function:

◆ _assert_parameter_int_value()

bool ParameterTest::_assert_parameter_int_value ( param_t  param,
int32_t  expected 
)
private

Definition at line 90 of file test_parameters.cpp.

References param_get(), and ut_compare.

Referenced by _set_all_int_parameters_to(), ResetAll(), ResetAllExcludesBoundaryCheck(), ResetAllExcludesOne(), ResetAllExcludesTwo(), and ResetAllExcludesWildcard().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _set_all_int_parameters_to()

bool ParameterTest::_set_all_int_parameters_to ( int32_t  value)
private

Definition at line 110 of file test_parameters.cpp.

References _assert_parameter_int_value(), p0, p1, p2, p3, and param_set().

Referenced by ResetAll(), ResetAllExcludesBoundaryCheck(), ResetAllExcludesOne(), ResetAllExcludesTwo(), and ResetAllExcludesWildcard().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ exportImport()

bool ParameterTest::exportImport ( )
private

Definition at line 226 of file test_parameters.cpp.

References f(), p0, p1, p2, p3, p4, param_get(), param_load_default(), param_save_default(), param_set_no_notification(), param_type(), PARAM_TYPE_FLOAT, PARAM_TYPE_INT32, ut_assert, ut_compare, and ut_compare_float.

Referenced by run_tests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ exportImportAll()

bool ParameterTest::exportImportAll ( )
private

Definition at line 353 of file test_parameters.cpp.

References fd, param_count(), param_export(), param_for_index(), param_get(), param_import(), PARAM_INVALID, param_load_default(), param_reset_all(), param_save_default(), param_set_no_notification(), param_type(), PARAM_TYPE_FLOAT, PARAM_TYPE_INT32, ut_assert, and ut_compare.

Referenced by run_tests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResetAll()

bool ParameterTest::ResetAll ( )
private

Definition at line 142 of file test_parameters.cpp.

References _assert_parameter_int_value(), _set_all_int_parameters_to(), p0, p1, p2, p3, and param_reset_all().

Referenced by run_tests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResetAllExcludesBoundaryCheck()

bool ParameterTest::ResetAllExcludesBoundaryCheck ( )
private

Definition at line 192 of file test_parameters.cpp.

References _assert_parameter_int_value(), _set_all_int_parameters_to(), p0, p1, p2, p3, and param_reset_excludes().

Referenced by run_tests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResetAllExcludesOne()

bool ParameterTest::ResetAllExcludesOne ( )
private

Definition at line 158 of file test_parameters.cpp.

References _assert_parameter_int_value(), _set_all_int_parameters_to(), p0, p1, p2, p3, and param_reset_excludes().

Referenced by run_tests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResetAllExcludesTwo()

bool ParameterTest::ResetAllExcludesTwo ( )
private

Definition at line 175 of file test_parameters.cpp.

References _assert_parameter_int_value(), _set_all_int_parameters_to(), p0, p1, p2, p3, and param_reset_excludes().

Referenced by run_tests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResetAllExcludesWildcard()

bool ParameterTest::ResetAllExcludesWildcard ( )
private

Definition at line 209 of file test_parameters.cpp.

References _assert_parameter_int_value(), _set_all_int_parameters_to(), p0, p1, p2, p3, and param_reset_excludes().

Referenced by run_tests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_tests()

bool ParameterTest::run_tests ( )
virtual

Override to run your unit tests.

Unit tests should be called using ut_run_test macro.

Returns
true: all unit tests succeeded, false: one or more unit tests failed

Implements UnitTest.

Definition at line 536 of file test_parameters.cpp.

References UnitTest::_tests_failed, exportImport(), exportImportAll(), param_control_autosave(), ResetAll(), ResetAllExcludesBoundaryCheck(), ResetAllExcludesOne(), ResetAllExcludesTwo(), ResetAllExcludesWildcard(), SimpleFind(), test_parameters(), ut_declare_test_c, and ut_run_test.

Here is the call graph for this function:

◆ SetUp()

void ParameterTest::SetUp ( )
inlineoverride

Definition at line 44 of file ParameterTest.cpp.

References param_reset_all().

Here is the call graph for this function:

◆ SimpleFind()

bool ParameterTest::SimpleFind ( )
private

Definition at line 127 of file test_parameters.cpp.

References param_find(), param_get(), PARAM_INVALID, ut_assert_true, and ut_compare.

Referenced by run_tests().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ p0

◆ p1

◆ p2

◆ p3

◆ p4

param_t ParameterTest::p4 {PARAM_INVALID}
private

Definition at line 69 of file test_parameters.cpp.

Referenced by exportImport(), and ParameterTest().


The documentation for this class was generated from the following files: