current revision
This commit is contained in:
58
tests/RuntimeTests.h
Normal file
58
tests/RuntimeTests.h
Normal file
@@ -0,0 +1,58 @@
|
||||
#ifndef RUNTIMETESTS_H
|
||||
#define RUNTIMETESTS_H
|
||||
|
||||
#include <Indoor/sensors/radio/setup/WiFiFingerprint.h>
|
||||
#include "ipin/Scaler.h"
|
||||
|
||||
class RuntimeTests {
|
||||
|
||||
public:
|
||||
|
||||
static void run() {
|
||||
testFingerprint();
|
||||
testScaler();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static void testScaler() {
|
||||
|
||||
IPINScaler scaler = IPINScaler(1869, 1869, 40.51312440, -3.34959080, -40.73112000, 0.07596002);
|
||||
|
||||
// map center
|
||||
const float cenX = 1869/2.0*0.07596002;
|
||||
const float cenY = 1869/2.0*0.07596002;
|
||||
|
||||
const IPIN lonlat = scaler.toIPIN3(cenX, cenY, 0);
|
||||
Assert::isNear(40.51312440, lonlat.lat, 0.000001, "scaler error"); // lat = up/down
|
||||
Assert::isNear(-3.34959080, lonlat.lon, 0.000001, "scaler error"); // lon = left/right
|
||||
Assert::isNear(0.0, lonlat.floorNr, 0.1, "scaler error");
|
||||
|
||||
const Point3 p3 = scaler.convert3D(lonlat);
|
||||
Assert::isNear(cenX, p3.x, 0.01f, "scaler error");
|
||||
Assert::isNear(cenY, p3.y, 0.01f, "scaler error");
|
||||
Assert::isNear(0.0f, p3.z, 0.01f, "scaler error");
|
||||
|
||||
}
|
||||
|
||||
static void testFingerprint() {
|
||||
|
||||
MACAddress mac1("00:00:00:00:00:01");
|
||||
MACAddress mac2("00:00:00:00:00:02");
|
||||
|
||||
WiFiFingerprint fp;
|
||||
fp.measurements.entries.push_back( WiFiMeasurement(AccessPoint(mac1), -60));
|
||||
fp.measurements.entries.push_back( WiFiMeasurement(AccessPoint(mac1), -62));
|
||||
fp.measurements.entries.push_back( WiFiMeasurement(AccessPoint(mac1), -63));
|
||||
fp.measurements.entries.push_back( WiFiMeasurement(AccessPoint(mac2), -71));
|
||||
fp.measurements.entries.push_back( WiFiMeasurement(AccessPoint(mac2), -72));
|
||||
WiFiMeasurements avg = fp.average();
|
||||
Assert::equal(2, (int)avg.entries.size(), "size mismatch");
|
||||
Assert::isNear(-61.666f, avg.entries[1].rssi, 0.01f, "rssi avg mismatch");
|
||||
Assert::isNear(-71.500f, avg.entries[0].rssi, 0.01f, "rssi avg mismatch");
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // RUNTIMETESTS_H
|
||||
Reference in New Issue
Block a user