PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <px4_platform_common/log.h>
Go to the source code of this file.
Classes | |
class | UnitTest |
Base class to be used for unit tests. More... | |
Macros | |
#define | ut_declare_test_c(test_function, test_class) |
#define | ut_declare_test(test_function, test_class) |
Macro to create a function which will run a unit test class and print results. More... | |
#define | ut_run_test(test) |
Runs a single unit test. More... | |
#define | ut_assert(message, test) |
Used to assert a value within a unit test. More... | |
#define | ut_test(test) ut_assert("test", test) |
Used to assert a value within a unit test. More... | |
#define | ut_assert_true(test) |
To assert specifically to true. More... | |
#define | ut_assert_false(test) |
To assert specifically to true. More... | |
#define | ut_compare(message, v1, v2) |
Used to compare two integer values within a unit test. More... | |
#define | ut_compare_float(message, v1, v2, precision) |
Used to compare two float values within a unit test. More... | |
#define | ut_less_than(message, v1_smaller, v2_bigger) |
Used to compare two integer values within a unit test. More... | |
#define ut_assert | ( | message, | |
test | |||
) |
Used to assert a value within a unit test.
Definition at line 113 of file unit_test.h.
Referenced by MavlinkFtpTest::_burst_test(), SearchMinTest::_init_inputs(), SearchMinTest::_init_inputs_flipped(), SearchMinTest::_init_inputs_negative(), SearchMinTest::_init_tol_larger_than_range(), SearchMinTest::_init_tol_larger_than_range_flipped(), MavlinkFtpTest::_list_test(), SearchMinTest::_no_extremum(), MavlinkFtpTest::_read_test(), MavlinkFtpTest::_receive_message_handler_burst(), MavlinkFtpTest::_removedirectory_test(), MavlinkFtpTest::_removefile_test(), FloatTest::doublePrecisionTests(), ParameterTest::exportImport(), ParameterTest::exportImportAll(), IntTest::math3264MixedMathTests(), IntTest::math64bitTests(), FloatTest::singlePrecisionTests(), MathlibTest::testFinite(), MathlibTest::testMatrixNonsymmetric(), MathlibTest::testQuaternionfrom_dcm(), MathlibTest::testQuaternionfrom_euler(), MathlibTest::testQuaternionRotate(), and MathlibTest::testRotationMatrixQuaternion().
#define ut_assert_false | ( | test | ) |
To assert specifically to true.
Definition at line 138 of file unit_test.h.
#define ut_assert_true | ( | test | ) |
To assert specifically to true.
Definition at line 127 of file unit_test.h.
Referenced by BezierQuadTest::_get_arc_length(), BezierQuadTest::_get_states_from_time(), SmoothZTest::accelerateDownwardFromBrake(), SmoothZTest::accelerateUpwardFromBrake(), SmoothZTest::brakeDownward(), SmoothZTest::brakeUpward(), VersioningTest::run_tests(), ParameterTest::SimpleFind(), ListTest::test_add(), IntrusiveQueueTest::test_pop(), IntrusiveQueueTest::test_push(), IntrusiveQueueTest::test_push_duplicate(), ListTest::test_range_based_for(), IntrusiveQueueTest::test_remove(), ListTest::test_remove(), MathlibTest::testVector2(), and MathlibTest::testVector3().
#define ut_compare | ( | message, | |
v1, | |||
v2 | |||
) |
Used to compare two integer values within a unit test.
If possible use ut_compare instead of ut_assert since it will give you better error reporting of the actual values being compared.
Definition at line 150 of file unit_test.h.
Referenced by MavlinkFtpTest::_ack_test(), ParameterTest::_assert_parameter_float_value(), ParameterTest::_assert_parameter_int_value(), MavlinkFtpTest::_bad_datasize_test(), MavlinkFtpTest::_bad_opcode_test(), MavlinkFtpTest::_burst_test(), MavlinkFtpTest::_createdirectory_test(), MavlinkFtpTest::_decode_message(), MavlinkFtpTest::_list_eof_test(), MavlinkFtpTest::_list_test(), MavlinkFtpTest::_open_badfile_test(), MavlinkFtpTest::_open_terminate_test(), MavlinkFtpTest::_read_badsession_test(), MavlinkFtpTest::_read_test(), MavlinkFtpTest::_receive_message_handler_burst(), MavlinkFtpTest::_removedirectory_test(), MavlinkFtpTest::_removefile_test(), MavlinkFtpTest::_terminate_badsession_test(), StateMachineHelperTest::armingStateTransitionTest(), RCTest::crsfTest(), FloatTest::doublePrecisionTests(), RCTest::dsmTest(), ParameterTest::exportImport(), ParameterTest::exportImportAll(), StateMachineHelperTest::isSafeTest(), MixerTest::load_mixer(), StateMachineHelperTest::mainStateTransitionTest(), ParameterTest::SimpleFind(), FloatTest::singlePrecisionTests(), ListTest::test_add(), IntrusiveQueueTest::test_pop(), IntrusiveQueueTest::test_push(), IntrusiveQueueTest::test_push_duplicate(), ListTest::test_range_based_for(), IntrusiveQueueTest::test_remove(), and ListTest::test_remove().
#define ut_compare_float | ( | message, | |
v1, | |||
v2, | |||
precision | |||
) |
Used to compare two float values within a unit test.
If possible use ut_compare_float instead of ut_assert since it will give you better error reporting of the actual values being compared.
Definition at line 164 of file unit_test.h.
Referenced by ParameterTest::_assert_parameter_float_value(), BezierQuadTest::_get_states_from_time(), BezierQuadTest::_set_bez_from_vel(), AutoDeclinationTest::autodeclination_check(), and ParameterTest::exportImport().
#define ut_declare_test | ( | test_function, | |
test_class | |||
) |
Macro to create a function which will run a unit test class and print results.
Definition at line 82 of file unit_test.h.
Referenced by MavlinkFtpTest::run_tests(), and StateMachineHelperTest::run_tests().
#define ut_declare_test_c | ( | test_function, | |
test_class | |||
) |
Definition at line 40 of file unit_test.h.
Referenced by SearchMinTest::_no_extremum(), SmoothZTest::accelerateDownwardFromBrake(), BezierQuadTest::random(), MatrixTest::run_tests(), ParameterTest::run_tests(), AutoDeclinationTest::run_tests(), FloatTest::run_tests(), IntTest::run_tests(), MathlibTest::run_tests(), SF0XTest::sf0xTest(), RCTest::sumdTest(), ListTest::test_range_based_for(), and IntrusiveQueueTest::test_remove().
#define ut_less_than | ( | message, | |
v1_smaller, | |||
v2_bigger | |||
) |
Used to compare two integer values within a unit test.
If possible use ut_less_than instead of ut_assert since it will give you better error reporting of the actual values being compared.
Definition at line 179 of file unit_test.h.
#define ut_run_test | ( | test | ) |
Runs a single unit test.
Unit tests must have the function signature of bool test(void). The unit test should return true if it succeeded, false for fail.
Definition at line 96 of file unit_test.h.
Referenced by SF0XTest::run_tests(), RCTest::run_tests(), SmoothZTest::run_tests(), IntrusiveQueueTest::run_tests(), MavlinkFtpTest::run_tests(), BezierQuadTest::run_tests(), MatrixTest::run_tests(), ParameterTest::run_tests(), ListTest::run_tests(), StateMachineHelperTest::run_tests(), AutoDeclinationTest::run_tests(), FloatTest::run_tests(), IntTest::run_tests(), SearchMinTest::run_tests(), MathlibTest::run_tests(), MicroBenchHRT::MicroBenchHRT::run_tests(), MicroBenchMath::MicroBenchMath::run_tests(), MicroBenchMatrix::MicroBenchMatrix::run_tests(), MixerTest::run_tests(), and MicroBenchORB::MicroBenchORB::run_tests().
#define ut_test | ( | test | ) | ut_assert("test", test) |
Used to assert a value within a unit test.
Definition at line 124 of file unit_test.h.
Referenced by RCTest::crsfTest(), MatrixTest::dcmRenormTests(), RCTest::dsmTest(), MatrixTest::filterTests(), MatrixTest::helperTests(), MatrixTest::integrationTests(), MatrixTest::inverseTests(), MatrixTest::matrixAssignmentTests(), MatrixTest::matrixMultTests(), MatrixTest::matrixScalarMultTests(), MatrixTest::pseudoInverseTests(), MatrixTest::run_tests(), RCTest::sbus2Test(), MatrixTest::setIdentityTests(), SF0XTest::sf0xTest(), MatrixTest::sliceTests(), MatrixTest::squareMatrixTests(), RCTest::st24Test(), RCTest::sumdTest(), MatrixTest::transposeTests(), MatrixTest::vector2Tests(), MatrixTest::vector3Tests(), MatrixTest::vectorAssignmentTests(), and MatrixTest::vectorTests().