owlps/owlps-positioning/tests/interlinknetworks_test.hh

36 lines
940 B
C++
Raw Normal View History

#include <cxxtest/TestSuite.h>
#include "interlinknetworks.hh"
class InterlinkNetworks_test: public CxxTest::TestSuite
{
public:
void test_distance(void)
{
char mobile_gain = 3, mobile_power = 15 ;
Mobile mobile("", "", mobile_gain, mobile_power) ;
MultilaterationAlgorithm *algo = new InterlinkNetworks(&mobile) ;
char ap_gain = 5, ap_power = 20, ap_channel = 1 ;
AccessPoint ap(Point3D(), "", "", ap_gain, ap_power, ap_channel) ;
std::vector<int> ss_list ;
ss_list.push_back(-42) ;
Measurement measurement(&ap, ss_list) ;
/* ** How to check ref_distance in Scilab? **
* C = 5 + 20 + 20 * log10(300000000 / 2412000000 / (4 * PI)) + 3
* L = -42
* ref_distance = 10^((C-L)/35)
*/
float ref_distance = 7.1547 ;
float computed_distance = algo->estimate_distance(measurement) ;
TS_ASSERT_DELTA(computed_distance, ref_distance, 0.0001) ;
delete algo ;
}
} ;