PX4 Firmware
PX4 Autopilot Software http://px4.io
test_data_validator.cpp File Reference

Testing the DataValidator class. More...

#include <stdint.h>
#include <cassert>
#include <cstdlib>
#include <stdio.h>
#include <math.h>
#include <validation/data_validator.h>
#include <validation/tests/tests_common.h>
Include dependency graph for test_data_validator.cpp:

Go to the source code of this file.

Functions

void test_init ()
 
void test_put ()
 
void test_stale_detector ()
 Verify that the DataValidator detects sensor data that does not vary sufficiently. More...
 
void test_rms_calculation ()
 Verify the RMS error calculated by the DataValidator for a series of samples. More...
 
void test_error_tracking ()
 Verify error tracking performed by DataValidator::put. More...
 
int main (int argc, char *argv[])
 

Detailed Description

Testing the DataValidator class.

Author
Todd Stellanova

Definition in file test_data_validator.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 301 of file test_data_validator.cpp.

References test_error_tracking(), test_init(), test_put(), test_rms_calculation(), and test_stale_detector().

Here is the call graph for this function:

◆ test_error_tracking()

void test_error_tracking ( )

Verify error tracking performed by DataValidator::put.

Definition at line 203 of file test_data_validator.cpp.

References DataValidator::confidence(), dump_validator_state(), equal_value_count, DataValidator::error_count(), DataValidator::ERROR_FLAG_HIGH_ERRCOUNT, DataValidator::ERROR_FLAG_HIGH_ERRDENSITY, f(), DataValidator::put(), DataValidator::reset_state(), DataValidator::set_equal_value_threshold(), DataValidator::set_timeout(), DataValidator::state(), and DataValidator::used().

Referenced by main().

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

◆ test_init()

void test_init ( )

Definition at line 49 of file test_data_validator.cpp.

References DataValidator::confidence(), DataValidator::error_count(), DataValidator::ERROR_FLAG_NO_DATA, f(), DataValidator::get_timeout(), DataValidator::print(), DataValidator::priority(), DataValidator::set_timeout(), DataValidator::setSibling(), DataValidator::sibling(), state, DataValidator::state(), DataValidator::used(), and DataValidator::vibration_offset().

Referenced by main().

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

◆ test_put()

void test_put ( )

Definition at line 90 of file test_data_validator.cpp.

References DataValidator::confidence(), dump_validator_state(), DataValidator::ERROR_FLAG_TIMEOUT, f(), fill_validator_with_samples(), DataValidator::state(), DataValidator::used(), and DataValidator::value().

Referenced by main().

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

◆ test_rms_calculation()

void test_rms_calculation ( )

Verify the RMS error calculated by the DataValidator for a series of samples.

Definition at line 169 of file test_data_validator.cpp.

References equal_value_count, f(), insert_values_around_mean(), DataValidator::rms(), DataValidator::set_equal_value_threshold(), and DataValidator::vibration_offset().

Referenced by main().

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

◆ test_stale_detector()

void test_stale_detector ( )

Verify that the DataValidator detects sensor data that does not vary sufficiently.

Definition at line 138 of file test_data_validator.cpp.

References DataValidator::confidence(), dump_validator_state(), DataValidator::ERROR_FLAG_STALE_DATA, f(), fill_validator_with_samples(), state, and DataValidator::state().

Referenced by main().

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