kopia lustrzana https://github.com/bristol-seds/pico-tracker
Added a new test case that allows us to plot points processed on the ARM CM0+ back in the ipython notebook
rodzic
f27cbf760f
commit
88087381eb
|
@ -0,0 +1,33 @@
|
|||
#ifndef __verification__
|
||||
#define __verification__
|
||||
#endif
|
||||
|
||||
/****************************//* location_aprs_file_tc *//****************************/
|
||||
/* Checks the location is returning the right things etc. etc */
|
||||
|
||||
#include "location.h"
|
||||
|
||||
/* Parameters in */
|
||||
struct location_aprs_file_tc_params {
|
||||
|
||||
/* Input paramters to your test case go here */
|
||||
float lat;
|
||||
float lon;
|
||||
|
||||
} location_aprs_file_tc_params;
|
||||
/* Results out */
|
||||
struct location_aprs_file_tc_results {
|
||||
|
||||
/* Result values should be populated here */
|
||||
bool tx_allow;
|
||||
float frequency;
|
||||
|
||||
} location_aprs_file_tc_results;
|
||||
/* Function */
|
||||
__verification__ void location_aprs_file_tc(void) {
|
||||
|
||||
aprs_location_update(location_aprs_file_tc_params.lon, location_aprs_file_tc_params.lat, 1000);
|
||||
|
||||
location_aprs_file_tc_results.tx_allow = aprs_location_tx_allow();
|
||||
location_aprs_file_tc_results.frequency = aprs_location_frequency();
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Imports
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
import sys
|
||||
sys.path.append("./test")
|
||||
import main
|
||||
|
||||
from random import randint
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Test Script
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
class location_aprs_file_tc:
|
||||
def __init__(self):
|
||||
self.name = self.__class__.__name__
|
||||
self.iterations = 2000
|
||||
|
||||
self.locations = []
|
||||
|
||||
def teardown(self):
|
||||
# Write self.locations to json
|
||||
import json
|
||||
|
||||
outfile = open('../sim/geofence/location_aprs_file.json','w')
|
||||
print >>outfile, json.dumps(self.locations, sort_keys=True, indent=2)
|
||||
outfile.close()
|
||||
return None
|
||||
|
||||
|
||||
def get_test(self):
|
||||
"""Returns some suitable test parameters"""
|
||||
params = main.struct_location_aprs_file_tc_params()
|
||||
|
||||
"""
|
||||
Assign input parameters here
|
||||
"""
|
||||
params.lon = float(randint(-12000,24000))/1000
|
||||
params.lat = float(randint(45000,65000))/1000
|
||||
|
||||
return params
|
||||
|
||||
def is_correct(self, params, result, print_info):
|
||||
"""Returns if a result is correct for the given parameters"""
|
||||
|
||||
"""
|
||||
Compare result and params here, decide sth.
|
||||
Can use print_info
|
||||
"""
|
||||
freq = float(result['frequency']) / (1000*1000)
|
||||
|
||||
print_info("({:.1f}, {:.1f}): {:.3f} MHz".format(
|
||||
params.lat, params.lon, freq))
|
||||
|
||||
self.locations.append({
|
||||
'freq': freq,
|
||||
'lat': params.lat,
|
||||
'lon': params.lon
|
||||
})
|
||||
|
||||
return True
|
|
@ -175,6 +175,10 @@ class Tests():
|
|||
|
||||
params = test_case.get_test()
|
||||
|
||||
# Teardown testcase if required
|
||||
if hasattr(test_case, 'teardown'):
|
||||
test_case.teardown()
|
||||
|
||||
# Calculate time taken
|
||||
ttime = (arrow.now()-start)
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "location_aprs.h"
|
||||
#include "mem_write_page.h"
|
||||
#include "mem_write_all.h"
|
||||
#include "location_aprs_file.h"
|
||||
/* [new_tc] */
|
||||
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
Ładowanie…
Reference in New Issue