kopia lustrzana https://github.com/bristol-seds/pico-tracker
Added basic testcase for aprs geofence
rodzic
4098fc7e9f
commit
fcef15b7c6
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#include "times_two.h"
|
#include "times_two.h"
|
||||||
#include "osc8m_calib.h"
|
#include "osc8m_calib.h"
|
||||||
|
#include "location_aprs.h"
|
||||||
|
|
||||||
/******************************* tc_main ********************************/
|
/******************************* tc_main ********************************/
|
||||||
|
|
||||||
|
|
|
@ -2,19 +2,27 @@
|
||||||
#define __verification__
|
#define __verification__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/****************************//* location_aprs_tc *//****************************/
|
/****************************//* location_aprs_tc *//****************************/
|
||||||
/* Checks the location is returning the right things etc. etc */
|
/* Checks the location is returning the right things etc. etc */
|
||||||
|
|
||||||
|
#include "location.h"
|
||||||
|
|
||||||
/* Parameters in */
|
/* Parameters in */
|
||||||
struct location_aprs_tc_params {
|
struct location_aprs_tc_params {
|
||||||
int input;
|
float lat;
|
||||||
|
float lon;
|
||||||
} location_aprs_tc_params;
|
} location_aprs_tc_params;
|
||||||
/* Results out */
|
/* Results out */
|
||||||
struct location_aprs_tc_results {
|
struct location_aprs_tc_results {
|
||||||
int result;
|
bool tx_allow;
|
||||||
|
float frequency;
|
||||||
} location_aprs_tc_results;
|
} location_aprs_tc_results;
|
||||||
/* Function */
|
/* Function */
|
||||||
__verification__ void location_aprs_tc(void) {
|
__verification__ void location_aprs_tc(void) {
|
||||||
|
|
||||||
location_aprs_tc_results.result = 2 * location_aprs_tc_params.input;
|
aprs_location_update(location_aprs_tc_params.lon, location_aprs_tc_params.lat);
|
||||||
|
|
||||||
|
location_aprs_tc_results.tx_allow = aprs_location_tx_allow();
|
||||||
|
location_aprs_tc_results.frequency = aprs_location_frequency();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,22 +17,26 @@ from random import randint
|
||||||
class location_aprs_tc:
|
class location_aprs_tc:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.name = self.__class__.__name__
|
self.name = self.__class__.__name__
|
||||||
self.iterations = 20
|
self.iterations = 30
|
||||||
|
|
||||||
|
|
||||||
def get_test(self):
|
def get_test(self):
|
||||||
"""Returns some suitable test parameters"""
|
"""Returns some suitable test parameters"""
|
||||||
params = main.struct_location_aprs_tc_params()
|
params = main.struct_location_aprs_tc_params()
|
||||||
params.input = randint(0, 10000)
|
|
||||||
|
params.lon = -5 + randint(0, 120)*0.1;
|
||||||
|
params.lat = 52;
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
def is_correct(self, params, result, print_info):
|
def is_correct(self, params, result, print_info):
|
||||||
"""Returns if a result is correct for the given parameters"""
|
"""Returns if a result is correct for the given parameters"""
|
||||||
|
|
||||||
print_info("%d * 2 = %d"%(params.input, result['result']))
|
freq = result['frequency'] / (1000*1000)
|
||||||
|
status_str = "NO"
|
||||||
|
if result['tx_allow']:
|
||||||
|
status_str = "Tx"
|
||||||
|
|
||||||
if (params.input * 2 == result['result']):
|
print_info("%f, %f = %s, %f"%(params.lon, params.lat, status_str, freq))
|
||||||
return True
|
|
||||||
else:
|
return True
|
||||||
return False
|
|
||||||
|
|
Ładowanie…
Reference in New Issue