mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-01 02:50:35 +08:00
Testing cleanup from Daniel Agar
This commit is contained in:
@@ -50,7 +50,7 @@ class MavlinkFtpTest;
|
||||
class MavlinkFTP : public MavlinkStream
|
||||
{
|
||||
public:
|
||||
/// @brief Contructor is only public so unit test code can new objects.
|
||||
/// @brief Constructor is only public so unit test code can new objects.
|
||||
MavlinkFTP(Mavlink *mavlink);
|
||||
~MavlinkFTP();
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ bool MavlinkFtpTest::_list_test(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
/// @brief Tests for correct reponse to a List command on a valid directory, but with an offset that
|
||||
/// @brief Tests for correct response to a List command on a valid directory, but with an offset that
|
||||
/// is beyond the last directory entry.
|
||||
bool MavlinkFtpTest::_list_eof_test(void)
|
||||
{
|
||||
@@ -263,7 +263,7 @@ bool MavlinkFtpTest::_list_eof_test(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
/// @brief Tests for correct reponse to an Open command on a file which does not exist.
|
||||
/// @brief Tests for correct response to an Open command on a file which does not exist.
|
||||
bool MavlinkFtpTest::_open_badfile_test(void)
|
||||
{
|
||||
MavlinkFTP::PayloadHeader payload;
|
||||
|
||||
@@ -130,7 +130,7 @@ int uORBTest::UnitTest::pubsublatency_main(void)
|
||||
|
||||
pubsubtest_passed = true;
|
||||
|
||||
if (static_cast<float>(latency_integral / maxruns) > 40.0f) {
|
||||
if (static_cast<float>(latency_integral / maxruns) > 80.0f) {
|
||||
pubsubtest_res = uORB::ERROR;
|
||||
|
||||
} else {
|
||||
|
||||
@@ -37,6 +37,17 @@
|
||||
|
||||
#include <systemlib/err.h>
|
||||
|
||||
#define ut_declare_test_c(test_function, test_class) \
|
||||
extern "C" { \
|
||||
int test_function(int argc, char *argv[]) \
|
||||
{ \
|
||||
test_class* test = new test_class(); \
|
||||
bool success = test->run_tests(); \
|
||||
test->print_results(); \
|
||||
return success ? 0 : -1; \
|
||||
} \
|
||||
}
|
||||
|
||||
/// @brief Base class to be used for unit tests.
|
||||
class __EXPORT UnitTest
|
||||
{
|
||||
@@ -92,6 +103,9 @@ protected:
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/// @brief Used to assert a value within a unit test.
|
||||
#define ut_test(test) ut_assert("test", test)
|
||||
|
||||
/// @brief 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.
|
||||
#define ut_compare(message, v1, v2) \
|
||||
|
||||
Reference in New Issue
Block a user