[Positioner] tests: review and update (100% pass)
Review and fix all the tests so that 100% of the tests pass.
This commit is contained in:
parent
13f8847f65
commit
1eac9bb718
|
@ -222,3 +222,11 @@ add_custom_target(semistatic DEPENDS ${OWLPS_SEMISTATIC_TARGETS})
|
||||||
|
|
||||||
# The OWLPS_STATIC_TARGET is defined in subdirectories
|
# The OWLPS_STATIC_TARGET is defined in subdirectories
|
||||||
add_custom_target(static DEPENDS ${OWLPS_STATIC_TARGETS})
|
add_custom_target(static DEPENDS ${OWLPS_STATIC_TARGETS})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tests ###
|
||||||
|
|
||||||
|
add_custom_target(test
|
||||||
|
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_positioner
|
||||||
|
DEPENDS test_positioner)
|
||||||
|
|
|
@ -132,6 +132,15 @@ To display all the available targets, type:
|
||||||
``` make help
|
``` make help
|
||||||
|
|
||||||
|
|
||||||
|
= Running the tests =
|
||||||
|
|
||||||
|
To run the unit tests, use the ``test`` target:
|
||||||
|
|
||||||
|
``` make test
|
||||||
|
|
||||||
|
Currently, only OwlPS Positioner has unit tests.
|
||||||
|
|
||||||
|
|
||||||
= Compiling for OpenWrt =
|
= Compiling for OpenWrt =
|
||||||
|
|
||||||
== The OpenWrt toolchain ==
|
== The OpenWrt toolchain ==
|
||||||
|
|
40
TODO.t2t
40
TODO.t2t
|
@ -183,8 +183,6 @@ Work to do in OwlPS
|
||||||
- With autocalibration on, all the CPs declared in listeners.csv must
|
- With autocalibration on, all the CPs declared in listeners.csv must
|
||||||
be in coverage or the reference points will not be generated.
|
be in coverage or the reference points will not be generated.
|
||||||
|
|
||||||
- Unit tests are currently unmaintained. Do not try to run them.
|
|
||||||
|
|
||||||
|
|
||||||
== Algorithms ==
|
== Algorithms ==
|
||||||
|
|
||||||
|
@ -295,16 +293,44 @@ Work to do in OwlPS
|
||||||
|
|
||||||
== Unit tests ==
|
== Unit tests ==
|
||||||
|
|
||||||
- Update (rewrite?) tests.
|
- Classes with incomplete tests:
|
||||||
|
- InterlinkNetworks: compute()
|
||||||
|
- Measurement: average, variance, standard deviation, operations
|
||||||
|
- MinMax: trilaterate_2d()
|
||||||
|
- OutputCSV: write(ResultList)
|
||||||
|
- Point3D: distance & angle operations
|
||||||
|
- PosUtil: most functions
|
||||||
|
- ReferencePoint: operations
|
||||||
|
- Stock: a lot of functions
|
||||||
|
|
||||||
- Unfinished tests:
|
- Classes without tests or with mock test files (possibly untestable or
|
||||||
- InputDataReader
|
not worth testing, to be checked):
|
||||||
|
- Autocalibration
|
||||||
|
- CapturePointsReaderCSV
|
||||||
|
- CartographyAlgorithm
|
||||||
|
- CSVStringReader
|
||||||
|
- FBCM
|
||||||
|
- FRBHMBasic
|
||||||
- Input
|
- Input
|
||||||
|
- InputDataReader
|
||||||
|
- InputLogMedium
|
||||||
|
- InputMedium
|
||||||
|
- InputUDPSocket
|
||||||
|
- MobilesReaderCSV
|
||||||
|
- NSS
|
||||||
- Output
|
- Output
|
||||||
|
- OutputMedium
|
||||||
|
- OutputNetworkSocket
|
||||||
|
- OutputTCPSocketEvAAL
|
||||||
|
- OutputUDPSocket
|
||||||
- Positioning
|
- Positioning
|
||||||
|
- PositioningAlgorithm
|
||||||
|
- ResultList
|
||||||
|
- TrilaterationAlgorithm
|
||||||
|
- TrilaterationMethod
|
||||||
|
|
||||||
- Test InterlinkNetworks::compute() ?
|
|
||||||
|
|
||||||
- Timestamp: there is a probability of 10^-6 that the value in
|
- Timestamp: there is a probability of 10^-6 that the value in
|
||||||
nanoseconds and the rounded value in milliseconds are identical, in
|
nanoseconds and the rounded value in milliseconds are identical, in
|
||||||
which case some tests can fail.
|
which case one of the tests can fail. This could be fixed by retrying
|
||||||
|
the same test a couple of times.
|
||||||
|
|
|
@ -161,7 +161,6 @@ set(TESTS_SRC_FILES
|
||||||
${TESTS_DIR}/textfilewriter_test.hh
|
${TESTS_DIR}/textfilewriter_test.hh
|
||||||
${TESTS_DIR}/timestamp_test.hh
|
${TESTS_DIR}/timestamp_test.hh
|
||||||
${TESTS_DIR}/topologyreadercsv_test.hh
|
${TESTS_DIR}/topologyreadercsv_test.hh
|
||||||
${TESTS_DIR}/userinterface_test.hh
|
|
||||||
${TESTS_DIR}/waypoint_test.hh
|
${TESTS_DIR}/waypoint_test.hh
|
||||||
${TESTS_DIR}/wifidevice_test.hh
|
${TESTS_DIR}/wifidevice_test.hh
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,11 +8,9 @@ public:
|
||||||
|
|
||||||
void test_constructors(void)
|
void test_constructors(void)
|
||||||
{
|
{
|
||||||
// Default constructor
|
// We can't test the default constructor with two different objects
|
||||||
CalibrationRequest calibrationrequest00 ;
|
// like we usually do because the reception time is initialised by
|
||||||
std::vector<int> vi1 ;
|
// the Request constructor.
|
||||||
CalibrationRequest calibrationrequest01(Request(), NULL) ;
|
|
||||||
TS_ASSERT_EQUALS(calibrationrequest00, calibrationrequest01) ;
|
|
||||||
|
|
||||||
// Copy constructor
|
// Copy constructor
|
||||||
Mobile mobile1 ;
|
Mobile mobile1 ;
|
||||||
|
@ -25,7 +23,14 @@ public:
|
||||||
TS_ASSERT_EQUALS(calibrationrequest1, calibrationrequest2) ;
|
TS_ASSERT_EQUALS(calibrationrequest1, calibrationrequest2) ;
|
||||||
|
|
||||||
// Request copy constructor
|
// Request copy constructor
|
||||||
CalibrationRequest calibrationrequest3(request1) ;
|
/* We must force the request type to be the same in the Request and
|
||||||
|
* in the CalibrationRequest, because by default it is set to
|
||||||
|
* OWL_REQUEST_UNDEFINED for the Request and to
|
||||||
|
* OWL_REQUEST_AUTOCALIBRATION for the CalibrationRequest. */
|
||||||
|
request1.set_type(OWL_REQUEST_CALIBRATION) ;
|
||||||
|
CalibrationRequest
|
||||||
|
calibrationrequest3(request1, &referencepoint1, Direction(1),
|
||||||
|
OWL_REQUEST_CALIBRATION) ;
|
||||||
TS_ASSERT_EQUALS(request1, calibrationrequest3) ;
|
TS_ASSERT_EQUALS(request1, calibrationrequest3) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,10 +45,13 @@ public:
|
||||||
Timestamp timestamp1 ;
|
Timestamp timestamp1 ;
|
||||||
timestamp1.now() ;
|
timestamp1.now() ;
|
||||||
Request request1(&mobile1, timestamp1) ;
|
Request request1(&mobile1, timestamp1) ;
|
||||||
|
Direction direction1(1) ;
|
||||||
ReferencePoint referencepoint1(1,2,3) ;
|
ReferencePoint referencepoint1(1,2,3) ;
|
||||||
CalibrationRequest calibrationrequest1(request1, &referencepoint1) ;
|
CalibrationRequest
|
||||||
|
calibrationrequest1(request1, &referencepoint1, direction1) ;
|
||||||
TS_ASSERT_EQUALS(calibrationrequest1.get_mobile(), &mobile1) ;
|
TS_ASSERT_EQUALS(calibrationrequest1.get_mobile(), &mobile1) ;
|
||||||
TS_ASSERT_EQUALS(calibrationrequest1.get_time_sent(), timestamp1) ;
|
TS_ASSERT_EQUALS(calibrationrequest1.get_time_sent(), timestamp1) ;
|
||||||
|
TS_ASSERT_EQUALS(calibrationrequest1.get_direction(), direction1) ;
|
||||||
TS_ASSERT_EQUALS(calibrationrequest1.get_reference_point(),
|
TS_ASSERT_EQUALS(calibrationrequest1.get_reference_point(),
|
||||||
&referencepoint1) ;
|
&referencepoint1) ;
|
||||||
|
|
||||||
|
@ -56,6 +64,10 @@ public:
|
||||||
calibrationrequest1.set_time_sent(timestamp1) ;
|
calibrationrequest1.set_time_sent(timestamp1) ;
|
||||||
TS_ASSERT_EQUALS(calibrationrequest1.get_time_sent(), timestamp1) ;
|
TS_ASSERT_EQUALS(calibrationrequest1.get_time_sent(), timestamp1) ;
|
||||||
|
|
||||||
|
Direction direction2(2) ;
|
||||||
|
calibrationrequest1.set_direction(direction2) ;
|
||||||
|
TS_ASSERT_EQUALS(calibrationrequest1.get_direction(), direction2) ;
|
||||||
|
|
||||||
ReferencePoint referencepoint2(4,3,2) ;
|
ReferencePoint referencepoint2(4,3,2) ;
|
||||||
calibrationrequest1.set_reference_point(&referencepoint2) ;
|
calibrationrequest1.set_reference_point(&referencepoint2) ;
|
||||||
TS_ASSERT_EQUALS(calibrationrequest1.get_reference_point(),
|
TS_ASSERT_EQUALS(calibrationrequest1.get_reference_point(),
|
||||||
|
@ -63,6 +75,7 @@ public:
|
||||||
|
|
||||||
calibrationrequest1.clear() ;
|
calibrationrequest1.clear() ;
|
||||||
CalibrationRequest calibrationrequest2 ;
|
CalibrationRequest calibrationrequest2 ;
|
||||||
|
calibrationrequest2.clear() ;
|
||||||
TS_ASSERT_EQUALS(calibrationrequest1, calibrationrequest2) ;
|
TS_ASSERT_EQUALS(calibrationrequest1, calibrationrequest2) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,16 +87,37 @@ public:
|
||||||
Timestamp timestamp1 ;
|
Timestamp timestamp1 ;
|
||||||
timestamp1.now() ;
|
timestamp1.now() ;
|
||||||
Request request1(&mobile1, timestamp1) ;
|
Request request1(&mobile1, timestamp1) ;
|
||||||
|
Direction direction1(1) ;
|
||||||
ReferencePoint referencepoint1 ;
|
ReferencePoint referencepoint1 ;
|
||||||
CalibrationRequest calibrationrequest1(request1, &referencepoint1) ;
|
CalibrationRequest
|
||||||
CalibrationRequest calibrationrequest2(request1, &referencepoint1) ;
|
calibrationrequest1(request1, &referencepoint1,
|
||||||
|
direction1, OWL_REQUEST_CALIBRATION) ;
|
||||||
|
CalibrationRequest
|
||||||
|
calibrationrequest2(request1, &referencepoint1,
|
||||||
|
direction1, OWL_REQUEST_CALIBRATION) ;
|
||||||
|
TS_ASSERT_EQUALS(calibrationrequest1, calibrationrequest2) ;
|
||||||
|
|
||||||
|
// != and ==
|
||||||
|
Direction direction2(2) ;
|
||||||
|
calibrationrequest2.set_direction(direction2) ;
|
||||||
|
TS_ASSERT(calibrationrequest1 != calibrationrequest2) ;
|
||||||
|
|
||||||
|
calibrationrequest2.set_direction(direction1) ;
|
||||||
|
TS_ASSERT_EQUALS(calibrationrequest1, calibrationrequest2) ;
|
||||||
|
|
||||||
|
calibrationrequest2.set_type(OWL_REQUEST_AUTOCALIBRATION) ;
|
||||||
|
TS_ASSERT(calibrationrequest1 != calibrationrequest2) ;
|
||||||
|
|
||||||
|
calibrationrequest2.set_type(OWL_REQUEST_CALIBRATION) ;
|
||||||
TS_ASSERT_EQUALS(calibrationrequest1, calibrationrequest2) ;
|
TS_ASSERT_EQUALS(calibrationrequest1, calibrationrequest2) ;
|
||||||
|
|
||||||
// !=
|
|
||||||
timestamp1.now() ;
|
timestamp1.now() ;
|
||||||
Request request2(&mobile1, timestamp1) ;
|
Request request2(&mobile1, timestamp1) ;
|
||||||
ReferencePoint referencepoint2 ;
|
ReferencePoint referencepoint2 ;
|
||||||
CalibrationRequest calibrationrequest3(request2, &referencepoint2) ;
|
Direction direction3(3) ;
|
||||||
|
CalibrationRequest
|
||||||
|
calibrationrequest3(request2, &referencepoint2,
|
||||||
|
direction3, OWL_REQUEST_AUTOCALIBRATION) ;
|
||||||
TS_ASSERT(calibrationrequest1 != calibrationrequest3) ;
|
TS_ASSERT(calibrationrequest1 != calibrationrequest3) ;
|
||||||
|
|
||||||
// =
|
// =
|
||||||
|
|
|
@ -11,11 +11,13 @@ public:
|
||||||
// Default constructor
|
// Default constructor
|
||||||
CapturePoint capturepoint1 ;
|
CapturePoint capturepoint1 ;
|
||||||
CapturePoint capturepoint2(Point3D(), "", "",
|
CapturePoint capturepoint2(Point3D(), "", "",
|
||||||
CP_DEFAULT_ANTENNA_GAIN,
|
CP_DEFAULT_ANTENNA_GAIN,
|
||||||
WIFIDEVICE_DEFAULT_TRX_POWER,
|
WIFIDEVICE_DEFAULT_TRX_POWER,
|
||||||
CP_DEFAULT_CHANNEL) ;
|
CP_DEFAULT_CHANNEL) ;
|
||||||
TS_ASSERT_EQUALS(capturepoint1, capturepoint2) ;
|
TS_ASSERT_EQUALS(capturepoint1, capturepoint2) ;
|
||||||
|
|
||||||
|
// TODO: WifiDevice copy constructors
|
||||||
|
|
||||||
// Copy constructor
|
// Copy constructor
|
||||||
CapturePoint capturepoint3(Point3D(4,3,5), "192.168.0.1",
|
CapturePoint capturepoint3(Point3D(4,3,5), "192.168.0.1",
|
||||||
"AA:BB:CC:DD:EE:FF", 5, 32, 11) ;
|
"AA:BB:CC:DD:EE:FF", 5, 32, 11) ;
|
||||||
|
@ -29,7 +31,7 @@ public:
|
||||||
// Simple read accessors
|
// Simple read accessors
|
||||||
Point3D point3d1(78,23,4) ;
|
Point3D point3d1(78,23,4) ;
|
||||||
CapturePoint capturepoint1(point3d1, "192.168.0.1",
|
CapturePoint capturepoint1(point3d1, "192.168.0.1",
|
||||||
"AA:BB:CC:DD:EE:FF", 6, 38, 10) ;
|
"AA:BB:CC:DD:EE:FF", 6, 38, 10) ;
|
||||||
TS_ASSERT_EQUALS(capturepoint1.get_coordinates(), point3d1) ;
|
TS_ASSERT_EQUALS(capturepoint1.get_coordinates(), point3d1) ;
|
||||||
TS_ASSERT_EQUALS(capturepoint1.get_ip_addr(), "192.168.0.1") ;
|
TS_ASSERT_EQUALS(capturepoint1.get_ip_addr(), "192.168.0.1") ;
|
||||||
TS_ASSERT_EQUALS(capturepoint1.get_mac_addr(), "AA:BB:CC:DD:EE:FF") ;
|
TS_ASSERT_EQUALS(capturepoint1.get_mac_addr(), "AA:BB:CC:DD:EE:FF") ;
|
||||||
|
@ -63,15 +65,15 @@ public:
|
||||||
// ==
|
// ==
|
||||||
Point3D point3d1(78,23,4) ;
|
Point3D point3d1(78,23,4) ;
|
||||||
CapturePoint capturepoint1(point3d1, "192.168.0.1",
|
CapturePoint capturepoint1(point3d1, "192.168.0.1",
|
||||||
"AA:BB:CC:DD:EE:FF", 6, 38, 10) ;
|
"AA:BB:CC:DD:EE:FF", 6, 38, 10) ;
|
||||||
CapturePoint capturepoint2(point3d1, "192.168.0.1",
|
CapturePoint capturepoint2(point3d1, "192.168.0.1",
|
||||||
"AA:BB:CC:DD:EE:FF", 6, 38, 10) ;
|
"AA:BB:CC:DD:EE:FF", 6, 38, 10) ;
|
||||||
TS_ASSERT_EQUALS(capturepoint1, capturepoint2) ;
|
TS_ASSERT_EQUALS(capturepoint1, capturepoint2) ;
|
||||||
|
|
||||||
// !=
|
// !=
|
||||||
Point3D point3d2(7,3,24) ;
|
Point3D point3d2(7,3,24) ;
|
||||||
CapturePoint capturepoint3(point3d1, "10.0.0.1",
|
CapturePoint capturepoint3(point3d1, "10.0.0.1",
|
||||||
"AA:BB:CC:DD:EE:FF", 6, 38, 10) ;
|
"AA:BB:CC:DD:EE:FF", 6, 38, 10) ;
|
||||||
TS_ASSERT(capturepoint2 != capturepoint3) ;
|
TS_ASSERT(capturepoint2 != capturepoint3) ;
|
||||||
|
|
||||||
// =
|
// =
|
||||||
|
|
|
@ -85,7 +85,11 @@ public:
|
||||||
std::ofstream output_file(test_file_name.c_str()) ;
|
std::ofstream output_file(test_file_name.c_str()) ;
|
||||||
assert(output_file) ;
|
assert(output_file) ;
|
||||||
for (unsigned int i = 0 ; i < nlines ; ++i)
|
for (unsigned int i = 0 ; i < nlines ; ++i)
|
||||||
output_file << "aa:bb:cc:dd:ee:ff;1265120910725;0;0;0;0;11:22:33:44:55:01;-58;11:22:33:44:55:03;-50;11:22:33:44:55:02;-42;11:22:33:44:55:01;-55;11:22:33:44:55:02;-37\n" ;
|
output_file
|
||||||
|
<< "aa:bb:cc:dd:ee:ff;1265120910725;0;0;0;0;"
|
||||||
|
<< "11:22:33:44:55:01;-58;11:22:33:44:55:03;-50;"
|
||||||
|
<< "11:22:33:44:55:02;-42;11:22:33:44:55:01;-55;"
|
||||||
|
<< "11:22:33:44:55:02;-37\n" ;
|
||||||
output_file.close() ;
|
output_file.close() ;
|
||||||
|
|
||||||
CSVFileReader *csvfilereader ;
|
CSVFileReader *csvfilereader ;
|
||||||
|
|
|
@ -11,11 +11,10 @@ public:
|
||||||
{
|
{
|
||||||
// Default constructor
|
// Default constructor
|
||||||
TS_ASSERT_THROWS_NOTHING(Direction()) ;
|
TS_ASSERT_THROWS_NOTHING(Direction()) ;
|
||||||
Direction direction0 ;
|
|
||||||
TS_ASSERT(! direction0) ;
|
|
||||||
|
|
||||||
// char constructor
|
// int constructor
|
||||||
TS_ASSERT_THROWS(Direction(0), bad_direction) ;
|
// 0 is accepted, although it doesn't create a valid Direction
|
||||||
|
TS_ASSERT_THROWS_NOTHING(Direction(0)) ;
|
||||||
TS_ASSERT_THROWS(Direction(5), bad_direction) ;
|
TS_ASSERT_THROWS(Direction(5), bad_direction) ;
|
||||||
|
|
||||||
TS_ASSERT_THROWS_NOTHING(Direction(north)) ;
|
TS_ASSERT_THROWS_NOTHING(Direction(north)) ;
|
||||||
|
@ -43,6 +42,7 @@ public:
|
||||||
|
|
||||||
void test_operators(void)
|
void test_operators(void)
|
||||||
{
|
{
|
||||||
|
Direction direction0 ;
|
||||||
Direction direction1(Direction::north) ;
|
Direction direction1(Direction::north) ;
|
||||||
Direction direction2(Direction::east) ;
|
Direction direction2(Direction::east) ;
|
||||||
Direction direction3(Direction::south) ;
|
Direction direction3(Direction::south) ;
|
||||||
|
@ -61,6 +61,7 @@ public:
|
||||||
TS_ASSERT(direction5 != direction6) ;
|
TS_ASSERT(direction5 != direction6) ;
|
||||||
|
|
||||||
// bool
|
// bool
|
||||||
|
TS_ASSERT(! direction0) ;
|
||||||
TS_ASSERT(direction1) ;
|
TS_ASSERT(direction1) ;
|
||||||
TS_ASSERT(direction2) ;
|
TS_ASSERT(direction2) ;
|
||||||
TS_ASSERT(direction3) ;
|
TS_ASSERT(direction3) ;
|
||||||
|
|
|
@ -20,9 +20,6 @@ public:
|
||||||
// If we cannot open the file, we want to stop the test
|
// If we cannot open the file, we want to stop the test
|
||||||
CxxTest::setAbortTestOnFail(true) ;
|
CxxTest::setAbortTestOnFail(true) ;
|
||||||
|
|
||||||
// Clear the stock
|
|
||||||
Stock::clear() ;
|
|
||||||
|
|
||||||
csv_file_name = "/tmp/InputCSV_test_csv_file.csv" ;
|
csv_file_name = "/tmp/InputCSV_test_csv_file.csv" ;
|
||||||
TestUtil::create_test_csv_file(csv_file_name, true) ;
|
TestUtil::create_test_csv_file(csv_file_name, true) ;
|
||||||
|
|
||||||
|
@ -35,9 +32,6 @@ public:
|
||||||
{
|
{
|
||||||
// Delete the test CSV file
|
// Delete the test CSV file
|
||||||
TestUtil::remove_file(csv_file_name) ;
|
TestUtil::remove_file(csv_file_name) ;
|
||||||
|
|
||||||
// Clear the stock
|
|
||||||
Stock::clear() ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,27 +60,22 @@ public:
|
||||||
|
|
||||||
request1 = inputcsv1.get_next_request() ;
|
request1 = inputcsv1.get_next_request() ;
|
||||||
TS_ASSERT(request1) ;
|
TS_ASSERT(request1) ;
|
||||||
/*
|
|
||||||
assert(request1.get_mobile()) ;
|
assert(request1.get_mobile()) ;
|
||||||
TS_ASSERT_EQUALS(request1.get_mobile()->get_mac_addr(),
|
TS_ASSERT_EQUALS(request1.get_mobile()->get_mac_addr(),
|
||||||
TestUtil::mobiles[0].get_mac_addr()) ;
|
TestUtil::mobiles[0].get_mac_addr()) ;
|
||||||
TS_ASSERT_EQUALS(request1.get_time_sent(),
|
TS_ASSERT_EQUALS(request1.get_time_sent(),
|
||||||
TestUtil::requests.at(0)->get_time_sent()) ;
|
TestUtil::requests.at(0)->get_time_sent()) ;
|
||||||
|
|
||||||
for (std::vector<CapturePoint>::const_iterator i = TestUtil::aps.begin() ;
|
for (auto i = TestUtil::aps.begin() ; i != TestUtil::aps.end() ; ++i)
|
||||||
i != TestUtil::aps.end() ; ++i)
|
|
||||||
{
|
{
|
||||||
std::unordered_map<std::string, Measurement>::const_iterator
|
std::unordered_map<std::string, Measurement>::const_iterator
|
||||||
measurement_it1 =
|
measurement_it1 =
|
||||||
request1.get_measurements().find(i->get_mac_addr()) ;
|
request1.get_measurements().find(i->get_mac_addr()) ;
|
||||||
TS_ASSERT(request1.get_measurements().end() != measurement_it1) ;
|
TS_ASSERT(request1.get_measurements().end() != measurement_it1) ;
|
||||||
|
|
||||||
// TS_ASSERT_EQUALS(TestUtil::requests.at(0)->get_measurements().
|
// We cannot compare the complete ss_list since there is not a
|
||||||
// at(i->get_mac_addr()).get_ss_list(),
|
// Measurement::get_ss_list() any more.
|
||||||
// measurement_it1->second.get_ss_list()) ;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
TS_ASSERT(inputcsv1) ;
|
TS_ASSERT(inputcsv1) ;
|
||||||
TS_ASSERT(! inputcsv1.eof()) ;
|
TS_ASSERT(! inputcsv1.eof()) ;
|
||||||
|
@ -95,31 +84,24 @@ public:
|
||||||
|
|
||||||
request1 = inputcsv1.get_next_request() ;
|
request1 = inputcsv1.get_next_request() ;
|
||||||
TS_ASSERT(request1) ;
|
TS_ASSERT(request1) ;
|
||||||
/*
|
|
||||||
assert(request1.get_mobile()) ;
|
assert(request1.get_mobile()) ;
|
||||||
TS_ASSERT_EQUALS(request1.get_mobile()->get_mac_addr(),
|
TS_ASSERT_EQUALS(request1.get_mobile()->get_mac_addr(),
|
||||||
TestUtil::mobiles[1].get_mac_addr()) ;
|
TestUtil::mobiles[1].get_mac_addr()) ;
|
||||||
TS_ASSERT_EQUALS(request1.get_time_sent(),
|
TS_ASSERT_EQUALS(request1.get_time_sent(),
|
||||||
TestUtil::requests.at(1)->get_time_sent()) ;
|
TestUtil::requests.at(1)->get_time_sent()) ;
|
||||||
|
|
||||||
for (std::vector<CapturePoint>::const_iterator i = TestUtil::aps.begin() ;
|
for (auto i = TestUtil::aps.begin() ; i != TestUtil::aps.end() ; ++i)
|
||||||
i != TestUtil::aps.end() ; ++i)
|
|
||||||
{
|
{
|
||||||
std::unordered_map<std::string, Measurement>::const_iterator
|
std::unordered_map<std::string, Measurement>::const_iterator
|
||||||
measurement_it1 =
|
measurement_it1 =
|
||||||
request1.get_measurements().find(i->get_mac_addr()) ;
|
request1.get_measurements().find(i->get_mac_addr()) ;
|
||||||
TS_ASSERT(request1.get_measurements().end() != measurement_it1) ;
|
TS_ASSERT(request1.get_measurements().end() != measurement_it1) ;
|
||||||
// TS_ASSERT_EQUALS(TestUtil::requests.at(1)->get_measurements().
|
|
||||||
// at(i->get_mac_addr()).get_ss_list(),
|
|
||||||
// measurement_it1->second.get_ss_list()) ;
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// Third Request //
|
// Third Request //
|
||||||
|
|
||||||
TS_ASSERT(inputcsv1) ;
|
TS_ASSERT(inputcsv1) ;
|
||||||
TS_ASSERT(request1) ;
|
TS_ASSERT(request1) ;
|
||||||
/*
|
|
||||||
assert(request1.get_mobile()) ;
|
assert(request1.get_mobile()) ;
|
||||||
TS_ASSERT(! inputcsv1.eof()) ;
|
TS_ASSERT(! inputcsv1.eof()) ;
|
||||||
|
|
||||||
|
@ -129,18 +111,13 @@ public:
|
||||||
TS_ASSERT_EQUALS(request1.get_time_sent(),
|
TS_ASSERT_EQUALS(request1.get_time_sent(),
|
||||||
TestUtil::requests.at(2)->get_time_sent()) ;
|
TestUtil::requests.at(2)->get_time_sent()) ;
|
||||||
|
|
||||||
for (std::vector<CapturePoint>::const_iterator i = TestUtil::aps.begin() ;
|
for (auto i = TestUtil::aps.begin() ; i != TestUtil::aps.end() ; ++i)
|
||||||
i != TestUtil::aps.end() ; ++i)
|
|
||||||
{
|
{
|
||||||
std::unordered_map<std::string, Measurement>::const_iterator
|
std::unordered_map<std::string, Measurement>::const_iterator
|
||||||
measurement_it1 =
|
measurement_it1 =
|
||||||
request1.get_measurements().find(i->get_mac_addr()) ;
|
request1.get_measurements().find(i->get_mac_addr()) ;
|
||||||
TS_ASSERT(request1.get_measurements().end() != measurement_it1) ;
|
TS_ASSERT(request1.get_measurements().end() != measurement_it1) ;
|
||||||
// TS_ASSERT_EQUALS(TestUtil::requests.at(2)->get_measurements().
|
|
||||||
// at(i->get_mac_addr()).get_ss_list(),
|
|
||||||
// measurement_it1->second.get_ss_list()) ;
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// End of file
|
// End of file
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,6 @@ public:
|
||||||
// If we cannot open the file, we want to stop the test
|
// If we cannot open the file, we want to stop the test
|
||||||
CxxTest::setAbortTestOnFail(true) ;
|
CxxTest::setAbortTestOnFail(true) ;
|
||||||
|
|
||||||
// Clear the stock
|
|
||||||
Stock::clear() ;
|
|
||||||
|
|
||||||
csv_file_name = "/tmp/InputLogCSV_test_csv_file.csv" ;
|
csv_file_name = "/tmp/InputLogCSV_test_csv_file.csv" ;
|
||||||
TestUtil::create_test_csv_file(csv_file_name) ;
|
TestUtil::create_test_csv_file(csv_file_name) ;
|
||||||
|
|
||||||
|
@ -35,7 +32,6 @@ public:
|
||||||
{
|
{
|
||||||
TestUtil::remove_file(csv_file_name) ;
|
TestUtil::remove_file(csv_file_name) ;
|
||||||
TestUtil::remove_file(log_file_name) ;
|
TestUtil::remove_file(log_file_name) ;
|
||||||
Stock::clear() ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,8 +66,7 @@ public:
|
||||||
// Read the two files and compare to the reference Request list
|
// Read the two files and compare to the reference Request list
|
||||||
InputCSV inputcsv_csv(csv_file_name) ;
|
InputCSV inputcsv_csv(csv_file_name) ;
|
||||||
InputCSV inputcsv_log(log_file_name) ;
|
InputCSV inputcsv_log(log_file_name) ;
|
||||||
for (std::vector<Request*>::const_iterator i =
|
for (auto i = TestUtil::requests.begin() ;
|
||||||
TestUtil::requests.begin() ;
|
|
||||||
i != TestUtil::requests.end() ; ++i)
|
i != TestUtil::requests.end() ; ++i)
|
||||||
{
|
{
|
||||||
Stock::clear() ;
|
Stock::clear() ;
|
||||||
|
|
|
@ -11,12 +11,13 @@ public:
|
||||||
TrilaterationAlgorithm *algo = new InterlinkNetworks() ;
|
TrilaterationAlgorithm *algo = new InterlinkNetworks() ;
|
||||||
|
|
||||||
// Initialise algo->request
|
// Initialise algo->request
|
||||||
char mobile_gain = 3, mobile_power = 15 ;
|
float mobile_gain = 3, mobile_power = 15 ;
|
||||||
Mobile mobile("", "", mobile_gain, mobile_power) ;
|
Mobile mobile("", "", mobile_gain, mobile_power) ;
|
||||||
Request request(&mobile) ;
|
Request request(&mobile) ;
|
||||||
algo->compute(request) ; // yes, that's ugly
|
algo->compute(request) ; // yes, that's ugly
|
||||||
|
|
||||||
char ap_gain = 5, ap_power = 20, ap_channel = 1 ;
|
float ap_gain = 5, ap_power = 20 ;
|
||||||
|
unsigned int ap_channel = 1 ;
|
||||||
CapturePoint ap(Point3D(), "", "", ap_gain, ap_power, ap_channel) ;
|
CapturePoint ap(Point3D(), "", "", ap_gain, ap_power, ap_channel) ;
|
||||||
|
|
||||||
std::map<pkt_id_t, ss_t> ss_list ;
|
std::map<pkt_id_t, ss_t> ss_list ;
|
||||||
|
@ -24,12 +25,17 @@ public:
|
||||||
Measurement measurement(&ap) ;
|
Measurement measurement(&ap) ;
|
||||||
measurement.add_ss_list(ss_list) ;
|
measurement.add_ss_list(ss_list) ;
|
||||||
|
|
||||||
/* ** How to check ref_distance in Scilab? **
|
/* To check ref_distance in Scilab:
|
||||||
* C = 5 + 20 + 20 * log10(299792458 / 2412000000 / (4 * PI)) + 3
|
mobile_gain = 3
|
||||||
* L = -42
|
mobile_power = 15
|
||||||
* ref_distance = 10^((C-L)/35)
|
ap_gain = 5
|
||||||
|
celerity = 299792458
|
||||||
|
frequency = 2412000000
|
||||||
|
C = mobile_gain + mobile_power + ap_gain + 20 * log10(celerity / frequency / (4 * %pi))
|
||||||
|
L = -42
|
||||||
|
ref_distance = 10^((C-L)/35)
|
||||||
*/
|
*/
|
||||||
float ref_distance = 7.1519 ;
|
float ref_distance = 5.1470931 ;
|
||||||
|
|
||||||
float computed_distance = algo->estimate_distance(measurement) ;
|
float computed_distance = algo->estimate_distance(measurement) ;
|
||||||
TS_ASSERT_DELTA(computed_distance, ref_distance, 0.0001) ;
|
TS_ASSERT_DELTA(computed_distance, ref_distance, 0.0001) ;
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
m1.add_ss(1, -33) ;
|
m1.add_ss(1, -33) ;
|
||||||
m1.add_ss(2, -78) ;
|
m1.add_ss(2, -78) ;
|
||||||
m1.add_ss(3, -21) ;
|
m1.add_ss(3, -21) ;
|
||||||
|
TS_ASSERT_EQUALS(m1.get_nb_ss(), 3) ;
|
||||||
TS_ASSERT_EQUALS(m1.get_ss(1), -33) ;
|
TS_ASSERT_EQUALS(m1.get_ss(1), -33) ;
|
||||||
TS_ASSERT_EQUALS(m1.get_ss(2), -78) ;
|
TS_ASSERT_EQUALS(m1.get_ss(2), -78) ;
|
||||||
TS_ASSERT_EQUALS(m1.get_ss(3), -21) ;
|
TS_ASSERT_EQUALS(m1.get_ss(3), -21) ;
|
||||||
|
@ -64,18 +65,26 @@ public:
|
||||||
*/
|
*/
|
||||||
TS_ASSERT_DELTA(m1.get_average_dbm(), -25.505481, 0.0001) ;
|
TS_ASSERT_DELTA(m1.get_average_dbm(), -25.505481, 0.0001) ;
|
||||||
|
|
||||||
m1.clear() ;
|
Measurement m2(&ap2) ;
|
||||||
std::map<pkt_id_t, ss_t> vi2 ;
|
std::map<pkt_id_t, ss_t> vi2 ;
|
||||||
vi2[1] = -54 ;
|
vi2[3] = -54 ;
|
||||||
vi2[2] = -1 ;
|
vi2[4] = -1 ;
|
||||||
m1.add_ss_list(vi2) ;
|
m2.add_ss_list(vi2) ;
|
||||||
TS_ASSERT_EQUALS(m1.get_ss(1), -54) ;
|
TS_ASSERT_EQUALS(m2.get_nb_ss(), vi2.size()) ;
|
||||||
TS_ASSERT_EQUALS(m1.get_ss(2), -1) ;
|
TS_ASSERT_EQUALS(m2.get_ss(3), -54) ;
|
||||||
TS_ASSERT_DELTA(m1.get_average_dbm(), -4.0102782, 0.0001) ;
|
TS_ASSERT_EQUALS(m2.get_ss(4), -1) ;
|
||||||
|
TS_ASSERT_DELTA(m2.get_average_dbm(), -4.0102782, 0.0001) ;
|
||||||
|
|
||||||
|
m1.merge(m2) ;
|
||||||
|
TS_ASSERT_EQUALS(m1.get_nb_ss(), 4) ;
|
||||||
|
TS_ASSERT_EQUALS(m1.get_ss(1), -33) ;
|
||||||
|
TS_ASSERT_EQUALS(m1.get_ss(2), -78) ;
|
||||||
|
TS_ASSERT_EQUALS(m1.get_ss(3), -54) ;
|
||||||
|
TS_ASSERT_EQUALS(m1.get_ss(4), -1) ;
|
||||||
|
|
||||||
m1.clear() ;
|
m1.clear() ;
|
||||||
Measurement m2 ;
|
Measurement m3 ;
|
||||||
TS_ASSERT_EQUALS(m1, m2) ;
|
TS_ASSERT_EQUALS(m1, m3) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ public:
|
||||||
|
|
||||||
OutputCSV_test(void)
|
OutputCSV_test(void)
|
||||||
{
|
{
|
||||||
Stock::clear() ;
|
|
||||||
csv_file_name = "/tmp/OutputCSV_test_csv_file.csv" ;
|
csv_file_name = "/tmp/OutputCSV_test_csv_file.csv" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +18,6 @@ public:
|
||||||
~OutputCSV_test(void)
|
~OutputCSV_test(void)
|
||||||
{
|
{
|
||||||
TestUtil::remove_file(csv_file_name) ;
|
TestUtil::remove_file(csv_file_name) ;
|
||||||
Stock::clear() ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,11 +33,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void test_outputcsv(void)
|
void test_write_result(void)
|
||||||
{
|
{
|
||||||
OutputCSV *outputcsv1 = new OutputCSV(csv_file_name) ;
|
OutputCSV *outputcsv1 = new OutputCSV(csv_file_name) ;
|
||||||
for (std::vector<Result>::const_iterator i =
|
for (auto i = TestUtil::results.begin() ;
|
||||||
TestUtil::results.begin() ;
|
|
||||||
i != TestUtil::results.end() ; ++i)
|
i != TestUtil::results.end() ; ++i)
|
||||||
outputcsv1->write(*i) ;
|
outputcsv1->write(*i) ;
|
||||||
delete outputcsv1 ;
|
delete outputcsv1 ;
|
||||||
|
@ -52,15 +49,8 @@ public:
|
||||||
getline(inputcsv, line) ;
|
getline(inputcsv, line) ;
|
||||||
|
|
||||||
const Result &result = TestUtil::results.at(result_count) ;
|
const Result &result = TestUtil::results.at(result_count) ;
|
||||||
std::ostringstream result_csv ;
|
std::string result_csv = result.to_csv() ;
|
||||||
result_csv
|
TS_ASSERT_EQUALS(line, result_csv) ;
|
||||||
<< result.get_request()->get_mobile()->get_mac_addr() << ';'
|
|
||||||
<< result.get_request()->get_time_sent() << ';'
|
|
||||||
<< result.get_position().get_x() << ';'
|
|
||||||
<< result.get_position().get_y() << ';'
|
|
||||||
<< result.get_position().get_z() ;
|
|
||||||
|
|
||||||
TS_ASSERT_EQUALS(line, result_csv.str()) ;
|
|
||||||
|
|
||||||
if (++result_count >= TestUtil::results.size())
|
if (++result_count >= TestUtil::results.size())
|
||||||
break ;
|
break ;
|
||||||
|
|
|
@ -40,6 +40,23 @@ public:
|
||||||
TS_ASSERT_EQUALS(p1.get_y(), 321) ;
|
TS_ASSERT_EQUALS(p1.get_y(), 321) ;
|
||||||
p1.set_z(98) ;
|
p1.set_z(98) ;
|
||||||
TS_ASSERT_EQUALS(p1.get_z(), 98) ;
|
TS_ASSERT_EQUALS(p1.get_z(), 98) ;
|
||||||
|
|
||||||
|
p1.set_coordinates(78, 79, 80) ;
|
||||||
|
TS_ASSERT_EQUALS(p1.get_x(), 78) ;
|
||||||
|
TS_ASSERT_EQUALS(p1.get_y(), 79) ;
|
||||||
|
TS_ASSERT_EQUALS(p1.get_z(), 80) ;
|
||||||
|
|
||||||
|
Point3D p2(4, 5, 6) ;
|
||||||
|
p1.set_coordinates(p2) ;
|
||||||
|
TS_ASSERT_EQUALS(p1.get_x(), 4) ;
|
||||||
|
TS_ASSERT_EQUALS(p1.get_y(), 5) ;
|
||||||
|
TS_ASSERT_EQUALS(p1.get_z(), 6) ;
|
||||||
|
|
||||||
|
float p3[3] = {7, 8, 9} ;
|
||||||
|
p1.set_coordinates(p3) ;
|
||||||
|
TS_ASSERT_EQUALS(p1.get_x(), 7) ;
|
||||||
|
TS_ASSERT_EQUALS(p1.get_y(), 8) ;
|
||||||
|
TS_ASSERT_EQUALS(p1.get_z(), 9) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,6 +75,8 @@ public:
|
||||||
Point3D p5(23, 2.4, 0.4) ;
|
Point3D p5(23, 2.4, 0.4) ;
|
||||||
TS_ASSERT_DELTA(p4.distance(p5), 43.588, 0.001) ;
|
TS_ASSERT_DELTA(p4.distance(p5), 43.588, 0.001) ;
|
||||||
TS_ASSERT_DELTA(p4.square_distance(p5), 1900, 0.001) ;
|
TS_ASSERT_DELTA(p4.square_distance(p5), 1900, 0.001) ;
|
||||||
|
|
||||||
|
// TODO: complete this.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,18 +18,22 @@ public:
|
||||||
PositioningAlgorithm *algo = new RealPosition() ;
|
PositioningAlgorithm *algo = new RealPosition() ;
|
||||||
Result res ;
|
Result res ;
|
||||||
|
|
||||||
|
// Empty request
|
||||||
res = algo->compute(request) ;
|
res = algo->compute(request) ;
|
||||||
TS_ASSERT_EQUALS(res.get_position(), null_point) ;
|
TS_ASSERT_EQUALS(res.get_position(), null_point) ;
|
||||||
|
|
||||||
|
// Non-empty request
|
||||||
|
Point3D point(3,2,1) ;
|
||||||
|
request.set_real_position(point) ;
|
||||||
|
res = algo->compute(request) ;
|
||||||
|
TS_ASSERT_EQUALS(res.get_position(), point) ;
|
||||||
|
|
||||||
|
// Calibration request
|
||||||
res = algo->compute(calibration_request) ;
|
res = algo->compute(calibration_request) ;
|
||||||
TS_ASSERT_EQUALS(res.get_position(), reference_point) ;
|
TS_ASSERT_EQUALS(res.get_position(), reference_point) ;
|
||||||
|
|
||||||
Request *request_ptr ;
|
// CalibrationRequest casted to Request
|
||||||
request_ptr = &request ;
|
Request *request_ptr = static_cast<Request*>(&calibration_request) ;
|
||||||
res = algo->compute(*request_ptr) ;
|
|
||||||
TS_ASSERT_EQUALS(res.get_position(), null_point) ;
|
|
||||||
|
|
||||||
request_ptr = static_cast<Request*>(&calibration_request) ;
|
|
||||||
res = algo->compute(*request_ptr) ;
|
res = algo->compute(*request_ptr) ;
|
||||||
TS_ASSERT_EQUALS(res.get_position(), reference_point) ;
|
TS_ASSERT_EQUALS(res.get_position(), reference_point) ;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ class ReferencePoint_test: public CxxTest::TestSuite
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
void test_constructors(void)
|
void test_constructors(void)
|
||||||
{
|
{
|
||||||
// Default constructor
|
// Default constructor
|
||||||
|
@ -40,7 +41,8 @@ public:
|
||||||
TS_ASSERT_EQUALS(rp1.get_z(), 5) ;
|
TS_ASSERT_EQUALS(rp1.get_z(), 5) ;
|
||||||
|
|
||||||
// Write & read accessors
|
// Write & read accessors
|
||||||
CalibrationRequest calibrationrequest1, calibrationrequest2, calibrationrequest3 ;
|
CalibrationRequest
|
||||||
|
calibrationrequest1, calibrationrequest2, calibrationrequest3 ;
|
||||||
rp1.add_request(&calibrationrequest1) ;
|
rp1.add_request(&calibrationrequest1) ;
|
||||||
rp1.add_request(&calibrationrequest2) ;
|
rp1.add_request(&calibrationrequest2) ;
|
||||||
rp1.add_request(&calibrationrequest3) ;
|
rp1.add_request(&calibrationrequest3) ;
|
||||||
|
@ -55,37 +57,15 @@ public:
|
||||||
TS_ASSERT_EQUALS(rp1.get_y(), 321) ;
|
TS_ASSERT_EQUALS(rp1.get_y(), 321) ;
|
||||||
rp1.set_z(98) ;
|
rp1.set_z(98) ;
|
||||||
TS_ASSERT_EQUALS(rp1.get_z(), 98) ;
|
TS_ASSERT_EQUALS(rp1.get_z(), 98) ;
|
||||||
}
|
|
||||||
|
|
||||||
|
// delete_requests()
|
||||||
void test_ss_square_distance(void)
|
/* Note: as delete_requests() deletes the requests from the Stock,
|
||||||
{
|
* we must store them there first. */
|
||||||
CapturePoint ap1(Point3D(1,2,3), "aa:bb:cc:dd:ee:ff") ;
|
Stock::find_create_calibration_request(calibrationrequest1) ;
|
||||||
CalibrationRequest calibrationrequest1 ;
|
Stock::find_create_calibration_request(calibrationrequest2) ;
|
||||||
Measurement measurement1(&ap1) ;
|
Stock::find_create_calibration_request(calibrationrequest3) ;
|
||||||
measurement1.add_ss(1, -78) ;
|
rp1.delete_requests() ;
|
||||||
std::unordered_map<std::string, Measurement> measurements ;
|
TS_ASSERT(rp1.get_requests().empty()) ;
|
||||||
measurements["aa:bb:cc:dd:ee:ff"] = measurement1 ;
|
|
||||||
calibrationrequest1.set_measurements(measurements) ;
|
|
||||||
ReferencePoint referencepoint1 ;
|
|
||||||
referencepoint1.add_request(&calibrationrequest1) ;
|
|
||||||
/*
|
|
||||||
TS_ASSERT_EQUALS(0, referencepoint1.ss_square_distance(
|
|
||||||
calibrationrequest1)) ;
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Distance computation:
|
|
||||||
* (-42 - (-78))^2 == 1296
|
|
||||||
*/
|
|
||||||
CalibrationRequest calibrationrequest2 ;
|
|
||||||
measurement1.clear() ;
|
|
||||||
measurement1.add_ss(1, -42) ;
|
|
||||||
measurements["aa:bb:cc:dd:ee:ff"] = measurement1 ;
|
|
||||||
calibrationrequest2.set_measurements(measurements) ;
|
|
||||||
/*
|
|
||||||
TS_ASSERT_EQUALS(1296, referencepoint1.ss_square_distance(
|
|
||||||
calibrationrequest2)) ;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "request.hh"
|
#include "request.hh"
|
||||||
#include "mobile.hh"
|
#include "mobile.hh"
|
||||||
|
#include "timestamp.hh"
|
||||||
|
|
||||||
class Request_test: public CxxTest::TestSuite
|
class Request_test: public CxxTest::TestSuite
|
||||||
{
|
{
|
||||||
|
@ -9,17 +10,16 @@ public:
|
||||||
|
|
||||||
void test_constructors(void)
|
void test_constructors(void)
|
||||||
{
|
{
|
||||||
// Default constructor
|
// We can't test the default constructor with two different objects
|
||||||
Request r1 ;
|
// like we usually do because the reception time is initialised by
|
||||||
std::unordered_map<std::string, Measurement> measurements ;
|
// the Request constructor.
|
||||||
Request r2(measurements) ;
|
|
||||||
TS_ASSERT_EQUALS(r1, r2) ;
|
|
||||||
|
|
||||||
// Copy constructor
|
// Copy constructor
|
||||||
struct timespec current_time ;
|
std::unordered_map<std::string, Measurement> measurements ;
|
||||||
Measurement meas1 ;
|
Measurement meas1 ;
|
||||||
measurements["aa:bb:cc:dd:ee:ff"] = meas1 ;
|
measurements["AA:BB:CC:DD:EE:FF"] = meas1 ;
|
||||||
clock_gettime(CLOCK_REALTIME, ¤t_time) ;
|
Timestamp current_time ;
|
||||||
|
current_time.now() ;
|
||||||
Mobile mob1 ;
|
Mobile mob1 ;
|
||||||
Request r3(&mob1, current_time, measurements) ;
|
Request r3(&mob1, current_time, measurements) ;
|
||||||
Request r4(r3) ;
|
Request r4(r3) ;
|
||||||
|
@ -35,7 +35,7 @@ public:
|
||||||
CapturePoint ap1(Point3D(1,2,3), "192.168.0.1", "AA:BB:CC:DD:EE:FF") ;
|
CapturePoint ap1(Point3D(1,2,3), "192.168.0.1", "AA:BB:CC:DD:EE:FF") ;
|
||||||
Measurement meas1(&ap1) ;
|
Measurement meas1(&ap1) ;
|
||||||
std::unordered_map<std::string, Measurement> measurements ;
|
std::unordered_map<std::string, Measurement> measurements ;
|
||||||
measurements["aa:bb:cc:dd:ee:ff"] = meas1 ;
|
measurements["AA:BB:CC:DD:EE:FF"] = meas1 ;
|
||||||
Mobile mob1 ;
|
Mobile mob1 ;
|
||||||
Request r1(&mob1, current_time, measurements) ;
|
Request r1(&mob1, current_time, measurements) ;
|
||||||
TS_ASSERT_EQUALS(r1.get_mobile(), &mob1) ;
|
TS_ASSERT_EQUALS(r1.get_mobile(), &mob1) ;
|
||||||
|
@ -43,6 +43,12 @@ public:
|
||||||
TS_ASSERT_EQUALS(r1.get_measurements(), measurements) ;
|
TS_ASSERT_EQUALS(r1.get_measurements(), measurements) ;
|
||||||
|
|
||||||
// Write & read accessors
|
// Write & read accessors
|
||||||
|
r1.set_type(OWL_REQUEST_GENERATED) ;
|
||||||
|
TS_ASSERT_EQUALS(r1.get_type(), OWL_REQUEST_GENERATED) ;
|
||||||
|
|
||||||
|
r1.set_nb_packets(42) ;
|
||||||
|
TS_ASSERT_EQUALS(r1.get_nb_packets(), 42) ;
|
||||||
|
|
||||||
Mobile mob2 ;
|
Mobile mob2 ;
|
||||||
r1.set_mobile(&mob2) ;
|
r1.set_mobile(&mob2) ;
|
||||||
TS_ASSERT_EQUALS(r1.get_mobile(), &mob2) ;
|
TS_ASSERT_EQUALS(r1.get_mobile(), &mob2) ;
|
||||||
|
@ -51,39 +57,53 @@ public:
|
||||||
r1.set_time_sent(current_time) ;
|
r1.set_time_sent(current_time) ;
|
||||||
TS_ASSERT_EQUALS(r1.get_time_sent(), current_time) ;
|
TS_ASSERT_EQUALS(r1.get_time_sent(), current_time) ;
|
||||||
|
|
||||||
|
current_time.now() ;
|
||||||
|
r1.received_now() ;
|
||||||
|
TS_ASSERT_DELTA(static_cast<uint64_t>(r1.get_time_received()),
|
||||||
|
static_cast<uint64_t>(current_time),
|
||||||
|
100) ;
|
||||||
|
|
||||||
CapturePoint ap2(Point3D(3,2,1), "192.168.0.2", "AA:BB:CC:DD:EE:02") ;
|
CapturePoint ap2(Point3D(3,2,1), "192.168.0.2", "AA:BB:CC:DD:EE:02") ;
|
||||||
Measurement meas2(&ap2) ;
|
Measurement meas2(&ap2) ;
|
||||||
measurements["aa:bb:cc:dd:ee:02"] = meas2 ;
|
measurements["AA:BB:CC:DD:EE:02"] = meas2 ;
|
||||||
r1.set_measurements(measurements) ;
|
r1.set_measurements(measurements) ;
|
||||||
TS_ASSERT_EQUALS(r1.get_measurements(), measurements) ;
|
TS_ASSERT_EQUALS(r1.get_measurements(), measurements) ;
|
||||||
|
|
||||||
// clear()
|
// clear()
|
||||||
r1.clear() ;
|
r1.clear() ;
|
||||||
Request r2 ;
|
Request r2 ;
|
||||||
|
r2.clear() ;
|
||||||
TS_ASSERT_EQUALS(r1, r2) ;
|
TS_ASSERT_EQUALS(r1, r2) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Operations:
|
||||||
|
* We don't test similarity() because it's just a wrapper around
|
||||||
|
* PosUtil functions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
void test_operators(void)
|
void test_operators(void)
|
||||||
{
|
{
|
||||||
// ==
|
// ==
|
||||||
struct timespec current_time ;
|
Timestamp current_time ;
|
||||||
|
current_time.now() ;
|
||||||
std::unordered_map<std::string, Measurement> measurements ;
|
std::unordered_map<std::string, Measurement> measurements ;
|
||||||
Measurement meas1 ;
|
Measurement meas1 ;
|
||||||
measurements["aa:bb:cc:dd:ee:00"] = meas1 ;
|
measurements["AA:BB:CC:DD:EE:00"] = meas1 ;
|
||||||
clock_gettime(CLOCK_REALTIME, ¤t_time) ;
|
|
||||||
Request r1(current_time, measurements) ;
|
Request r1(current_time, measurements) ;
|
||||||
Request r2(current_time, measurements) ;
|
Request r2(r1) ;
|
||||||
TS_ASSERT_EQUALS(r1, r2) ;
|
TS_ASSERT_EQUALS(r1, r2) ;
|
||||||
|
|
||||||
Mobile mob1 ;
|
Mobile mob1 ;
|
||||||
Request r3(&mob1, current_time, measurements) ;
|
Request r3(&mob1, current_time, measurements) ;
|
||||||
Request r4(&mob1, current_time, measurements) ;
|
Request r4(r3) ;
|
||||||
TS_ASSERT_EQUALS(r3, r4) ;
|
TS_ASSERT_EQUALS(r3, r4) ;
|
||||||
|
|
||||||
// !=
|
// !=
|
||||||
Measurement meas2 ;
|
Measurement meas2 ;
|
||||||
measurements["aa:bb:cc:dd:ee:01"] = meas2 ;
|
measurements["AA:BB:CC:DD:EE:01"] = meas2 ;
|
||||||
Request r5(&mob1, current_time, measurements) ;
|
Request r5(&mob1, current_time, measurements) ;
|
||||||
TS_ASSERT(r4 != r5) ;
|
TS_ASSERT(r4 != r5) ;
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,12 @@ class Result_test: public CxxTest::TestSuite
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void test_constructor(void)
|
void test_constructors(void)
|
||||||
{
|
{
|
||||||
// Default constructor
|
// Default constructor
|
||||||
Result result1 ;
|
Result result1 ;
|
||||||
Result result2(NULL) ;
|
Result result2(NULL) ;
|
||||||
Result result3(NULL, Point3D()) ;
|
Result result3(NULL, "UnknownAlgorithm") ;
|
||||||
TS_ASSERT_EQUALS(result1, result2) ;
|
TS_ASSERT_EQUALS(result1, result2) ;
|
||||||
TS_ASSERT_EQUALS(result1, result3) ;
|
TS_ASSERT_EQUALS(result1, result3) ;
|
||||||
|
|
||||||
|
@ -23,14 +23,32 @@ public:
|
||||||
|
|
||||||
void test_accessors(void)
|
void test_accessors(void)
|
||||||
{
|
{
|
||||||
|
// We cannot test easily in_which_area() without a complete
|
||||||
|
// configuration.
|
||||||
|
|
||||||
Timestamp timestamp1 ;
|
Timestamp timestamp1 ;
|
||||||
timestamp1.now() ;
|
timestamp1.now() ;
|
||||||
Request request1(timestamp1) ;
|
Request request1(timestamp1) ;
|
||||||
Point3D point3d1(3,4,2) ;
|
Point3D point3d1(3,4,2) ;
|
||||||
Result result1(&request1, point3d1) ;
|
Result result1(&request1, "MyAlgorithm", point3d1) ;
|
||||||
|
|
||||||
TS_ASSERT_EQUALS(result1.get_position(), point3d1) ;
|
TS_ASSERT_EQUALS(result1.get_position(), point3d1) ;
|
||||||
TS_ASSERT_EQUALS(result1.get_request(), &request1) ;
|
TS_ASSERT_EQUALS(result1.get_request(), &request1) ;
|
||||||
|
TS_ASSERT_EQUALS(result1.get_error(), -1) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_error(void)
|
||||||
|
{
|
||||||
|
Timestamp timestamp1 ;
|
||||||
|
timestamp1.now() ;
|
||||||
|
Request request1(timestamp1) ;
|
||||||
|
Point3D position(1, 1, 1), real_position(1, 5, 1) ;
|
||||||
|
Result result1(&request1, "MyAlgorithm", position, real_position) ;
|
||||||
|
TS_ASSERT_EQUALS(result1.get_error(), 4) ;
|
||||||
|
|
||||||
|
Point3D real_position2(1, 3.5, 1) ;
|
||||||
|
result1.compute_error(real_position2) ;
|
||||||
|
TS_ASSERT_EQUALS(result1.get_error(), 2.5) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_operators(void)
|
void test_operators(void)
|
||||||
|
|
|
@ -7,11 +7,13 @@ class Stock_test: public CxxTest::TestSuite
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Run before each test
|
||||||
void setUp(void)
|
void setUp(void)
|
||||||
{
|
{
|
||||||
Stock::clear() ;
|
Stock::clear() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run after each test
|
||||||
void tearDown(void)
|
void tearDown(void)
|
||||||
{
|
{
|
||||||
Stock::clear() ;
|
Stock::clear() ;
|
||||||
|
@ -87,7 +89,7 @@ public:
|
||||||
TS_ASSERT_EQUALS(Stock::getw_cp("00:00:00:00:02:01"), ap1) ;
|
TS_ASSERT_EQUALS(Stock::getw_cp("00:00:00:00:02:01"), ap1) ;
|
||||||
|
|
||||||
CapturePoint ap2(Point3D(1,2,3), "192.168.2.1", "00:00:00:00:02:02",
|
CapturePoint ap2(Point3D(1,2,3), "192.168.2.1", "00:00:00:00:02:02",
|
||||||
8.5, 2.1, 11) ;
|
8.5, 2.1, 11) ;
|
||||||
Stock::getw_cp("00:00:00:00:02:02") = ap2 ;
|
Stock::getw_cp("00:00:00:00:02:02") = ap2 ;
|
||||||
TS_ASSERT_EQUALS(Stock::get_cp("00:00:00:00:02:02"), ap2) ;
|
TS_ASSERT_EQUALS(Stock::get_cp("00:00:00:00:02:02"), ap2) ;
|
||||||
TS_ASSERT_EQUALS(Stock::getw_cp("00:00:00:00:02:02"), ap2) ;
|
TS_ASSERT_EQUALS(Stock::getw_cp("00:00:00:00:02:02"), ap2) ;
|
||||||
|
@ -130,7 +132,7 @@ public:
|
||||||
Measurement measurement1(&ap1) ;
|
Measurement measurement1(&ap1) ;
|
||||||
measurement1.add_ss(1, -23) ;
|
measurement1.add_ss(1, -23) ;
|
||||||
std::unordered_map<std::string, Measurement> measurements ;
|
std::unordered_map<std::string, Measurement> measurements ;
|
||||||
measurements["aa:bb:cc:dd:ee:ff"] = measurement1 ;
|
measurements["AA:BB:CC:DD:EE:FF"] = measurement1 ;
|
||||||
calibrationrequest1.set_measurements(measurements) ;
|
calibrationrequest1.set_measurements(measurements) ;
|
||||||
TS_ASSERT_THROWS(Stock::closest_reference_point(calibrationrequest1),
|
TS_ASSERT_THROWS(Stock::closest_reference_point(calibrationrequest1),
|
||||||
element_not_found) ;
|
element_not_found) ;
|
||||||
|
@ -147,7 +149,7 @@ public:
|
||||||
Measurement measurement2(&ap1) ;
|
Measurement measurement2(&ap1) ;
|
||||||
measurement2.add_ss(1, -78) ;
|
measurement2.add_ss(1, -78) ;
|
||||||
measurements.clear() ;
|
measurements.clear() ;
|
||||||
measurements["aa:bb:cc:dd:ee:ff"] = measurement2 ;
|
measurements["AA:BB:CC:DD:EE:FF"] = measurement2 ;
|
||||||
calibrationrequest2.set_measurements(measurements) ;
|
calibrationrequest2.set_measurements(measurements) ;
|
||||||
ReferencePoint referencepoint2(88,99,111) ;
|
ReferencePoint referencepoint2(88,99,111) ;
|
||||||
referencepoint2.add_request(&calibrationrequest2) ;
|
referencepoint2.add_request(&calibrationrequest2) ;
|
||||||
|
@ -164,7 +166,7 @@ public:
|
||||||
Measurement measurement3(&ap1) ;
|
Measurement measurement3(&ap1) ;
|
||||||
measurement3.add_ss(1, -75) ;
|
measurement3.add_ss(1, -75) ;
|
||||||
measurements.clear() ;
|
measurements.clear() ;
|
||||||
measurements["aa:bb:cc:dd:ee:ff"] = measurement3 ;
|
measurements["AA:BB:CC:DD:EE:FF"] = measurement3 ;
|
||||||
request3.set_measurements(measurements) ;
|
request3.set_measurements(measurements) ;
|
||||||
TS_ASSERT_EQUALS(
|
TS_ASSERT_EQUALS(
|
||||||
&Stock::closest_reference_point(request3),
|
&Stock::closest_reference_point(request3),
|
||||||
|
@ -174,7 +176,7 @@ public:
|
||||||
Measurement measurement4(&ap1) ;
|
Measurement measurement4(&ap1) ;
|
||||||
measurement4.add_ss(1, -8) ;
|
measurement4.add_ss(1, -8) ;
|
||||||
measurements.clear() ;
|
measurements.clear() ;
|
||||||
measurements["aa:bb:cc:dd:ee:ff"] = measurement4 ;
|
measurements["AA:BB:CC:DD:EE:FF"] = measurement4 ;
|
||||||
request4.set_measurements(measurements) ;
|
request4.set_measurements(measurements) ;
|
||||||
TS_ASSERT_EQUALS(
|
TS_ASSERT_EQUALS(
|
||||||
&Stock::closest_reference_point(request4),
|
&Stock::closest_reference_point(request4),
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
static TestSetUp testsetup ;
|
static TestSetUp testsetup ;
|
||||||
|
|
||||||
|
|
||||||
|
// This is called before each test suite
|
||||||
bool TestSetUp::setUpWorld(void)
|
bool TestSetUp::setUpWorld(void)
|
||||||
{
|
{
|
||||||
TestUtil::set_up() ;
|
TestUtil::set_up() ;
|
||||||
|
@ -12,6 +13,7 @@ bool TestSetUp::setUpWorld(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// This is called after each test suite
|
||||||
bool TestSetUp::tearDownWorld(void)
|
bool TestSetUp::tearDownWorld(void)
|
||||||
{
|
{
|
||||||
TestUtil::tear_down() ;
|
TestUtil::tear_down() ;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "testutil.hh"
|
#include "testutil.hh"
|
||||||
#include <cxxtest/TestSuite.h>
|
#include <cxxtest/TestSuite.h>
|
||||||
|
|
||||||
|
#include "stock.hh"
|
||||||
|
#include "userinterface.hh"
|
||||||
#include "calibrationrequest.hh"
|
#include "calibrationrequest.hh"
|
||||||
#include "realposition.hh"
|
#include "realposition.hh"
|
||||||
|
|
||||||
|
@ -19,6 +21,8 @@ vector<ReferencePoint> TestUtil::reference_points ;
|
||||||
|
|
||||||
void TestUtil::tear_down()
|
void TestUtil::tear_down()
|
||||||
{
|
{
|
||||||
|
Stock::clear() ;
|
||||||
|
|
||||||
aps.clear() ;
|
aps.clear() ;
|
||||||
mobiles.clear() ;
|
mobiles.clear() ;
|
||||||
|
|
||||||
|
@ -39,6 +43,7 @@ void TestUtil::set_up()
|
||||||
create_cp_list() ;
|
create_cp_list() ;
|
||||||
create_request_list() ;
|
create_request_list() ;
|
||||||
create_result_list() ;
|
create_result_list() ;
|
||||||
|
setup_configuration() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestUtil::create_mobile_list()
|
void TestUtil::create_mobile_list()
|
||||||
|
@ -154,6 +159,23 @@ void TestUtil::create_result_list()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestUtil::setup_configuration()
|
||||||
|
{
|
||||||
|
const std::string config_file_name("/dev/null") ;
|
||||||
|
const char *argv[] =
|
||||||
|
{
|
||||||
|
"owlps-positionerd", // program name
|
||||||
|
"--config-file", config_file_name.c_str(),
|
||||||
|
"--positioning.area-start", "0;0;0",
|
||||||
|
"--positioning.area-stop", "10;15;3",
|
||||||
|
"--positioning.accept-new-mobiles", "true",
|
||||||
|
"--positioning.accept-new-cps", "true"
|
||||||
|
} ;
|
||||||
|
int argc = 11 ;
|
||||||
|
|
||||||
|
UserInterface ui(argc, argv) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Create the file output_file_name and fill it with the contents of
|
// Create the file output_file_name and fill it with the contents of
|
||||||
// output_lines
|
// output_lines
|
||||||
|
@ -189,53 +211,72 @@ create_test_csv_file(const string &file_name, bool with_spaces)
|
||||||
// Fill name and contents of the test CSV file
|
// Fill name and contents of the test CSV file
|
||||||
vector<string> csv_lines ;
|
vector<string> csv_lines ;
|
||||||
ostringstream line ;
|
ostringstream line ;
|
||||||
|
constexpr unsigned int csv_format = OWL_LATEST_AGGREGATION_CSV_FORMAT ;
|
||||||
|
|
||||||
|
/* The CSV format to use is documented in the header of InputCSV */
|
||||||
|
|
||||||
if (with_spaces)
|
if (with_spaces)
|
||||||
line << "\n \n " ;
|
line << "\n \n " ;
|
||||||
line << mobiles[0].get_mac_addr() ;
|
line << csv_format ;
|
||||||
|
line << ';' << mobiles[0].get_mac_addr() ;
|
||||||
|
line << ';' << static_cast<uint_fast16_t>(requests.at(0)->get_type()) ;
|
||||||
|
line << ';' << requests.at(0)->get_nb_packets() ;
|
||||||
line << ';' << requests.at(0)->get_time_sent() ;
|
line << ';' << requests.at(0)->get_time_sent() ;
|
||||||
line << ";0;0;0;0;" ;
|
line << ";0;0;0;0;" ;
|
||||||
line << aps[0].get_mac_addr() ;
|
line << aps[0].get_mac_addr() ;
|
||||||
|
line << ';' << 1 ;
|
||||||
line << ';' << requests.at(0)->get_measurements()
|
line << ';' << requests.at(0)->get_measurements()
|
||||||
.at(aps[0].get_mac_addr()).get_ss(1) ;
|
.at(aps[0].get_mac_addr()).get_ss(1) ;
|
||||||
line << ';' << aps[2].get_mac_addr() ;
|
line << ';' << aps[2].get_mac_addr() ;
|
||||||
|
line << ';' << 1 ;
|
||||||
line << ';' << requests.at(0)->get_measurements()
|
line << ';' << requests.at(0)->get_measurements()
|
||||||
.at(aps[2].get_mac_addr()).get_ss(1) ;
|
.at(aps[2].get_mac_addr()).get_ss(1) ;
|
||||||
line << ';' << aps[1].get_mac_addr() ;
|
line << ';' << aps[1].get_mac_addr() ;
|
||||||
|
line << ';' << 1 ;
|
||||||
line << ';' << requests.at(0)->get_measurements()
|
line << ';' << requests.at(0)->get_measurements()
|
||||||
.at(aps[1].get_mac_addr()).get_ss(1) ;
|
.at(aps[1].get_mac_addr()).get_ss(1) ;
|
||||||
line << ';' << aps[0].get_mac_addr() ;
|
line << ';' << aps[0].get_mac_addr() ;
|
||||||
|
line << ';' << 2 ;
|
||||||
line << ';' << requests.at(0)->get_measurements()
|
line << ';' << requests.at(0)->get_measurements()
|
||||||
.at(aps[0].get_mac_addr()).get_ss(2) ;
|
.at(aps[0].get_mac_addr()).get_ss(2) ;
|
||||||
line << ';' << aps[1].get_mac_addr() ;
|
line << ';' << aps[1].get_mac_addr() ;
|
||||||
|
line << ';' << 2 ;
|
||||||
line << ';' << requests.at(0)->get_measurements()
|
line << ';' << requests.at(0)->get_measurements()
|
||||||
.at(aps[1].get_mac_addr()).get_ss(2) ;
|
.at(aps[1].get_mac_addr()).get_ss(2) ;
|
||||||
line << '\n' ;
|
line << '\n' ;
|
||||||
csv_lines.push_back(line.str()) ;
|
csv_lines.push_back(line.str()) ;
|
||||||
|
|
||||||
line.str("") ;
|
line.str("") ;
|
||||||
line << mobiles[1].get_mac_addr() ;
|
line << csv_format ;
|
||||||
|
line << ';' << mobiles[1].get_mac_addr() ;
|
||||||
CalibrationRequest *calibration_request =
|
CalibrationRequest *calibration_request =
|
||||||
dynamic_cast<CalibrationRequest*>(requests.at(1)) ;
|
dynamic_cast<CalibrationRequest*>(requests.at(1)) ;
|
||||||
assert(calibration_request) ;
|
assert(calibration_request) ;
|
||||||
|
line << ';' << static_cast<uint_fast16_t>(calibration_request->get_type()) ;
|
||||||
|
line << ';' << calibration_request->get_nb_packets() ;
|
||||||
line << ';' << calibration_request->get_time_sent() ;
|
line << ';' << calibration_request->get_time_sent() ;
|
||||||
line << ';' << reference_points.at(0).get_x() ;
|
line << ';' << reference_points.at(0).get_x() ;
|
||||||
line << ';' << reference_points.at(0).get_y() ;
|
line << ';' << reference_points.at(0).get_y() ;
|
||||||
line << ';' << reference_points.at(0).get_z() ;
|
line << ';' << reference_points.at(0).get_z() ;
|
||||||
line << ';' << static_cast<int>(calibration_request->get_direction()) ;
|
line << ';' << static_cast<int>(calibration_request->get_direction()) ;
|
||||||
line << ';' << aps[2].get_mac_addr() ;
|
line << ';' << aps[2].get_mac_addr() ;
|
||||||
|
line << ';' << 1 ;
|
||||||
line << ';' << calibration_request->get_measurements()
|
line << ';' << calibration_request->get_measurements()
|
||||||
.at(aps[2].get_mac_addr()).get_ss(1) ;
|
.at(aps[2].get_mac_addr()).get_ss(1) ;
|
||||||
line << ';' << aps[0].get_mac_addr() ;
|
line << ';' << aps[0].get_mac_addr() ;
|
||||||
|
line << ';' << 1 ;
|
||||||
line << ';' << calibration_request->get_measurements()
|
line << ';' << calibration_request->get_measurements()
|
||||||
.at(aps[0].get_mac_addr()).get_ss(1) ;
|
.at(aps[0].get_mac_addr()).get_ss(1) ;
|
||||||
line << ';' << aps[1].get_mac_addr() ;
|
line << ';' << aps[1].get_mac_addr() ;
|
||||||
|
line << ';' << 1 ;
|
||||||
line << ';' << calibration_request->get_measurements()
|
line << ';' << calibration_request->get_measurements()
|
||||||
.at(aps[1].get_mac_addr()).get_ss(1) ;
|
.at(aps[1].get_mac_addr()).get_ss(1) ;
|
||||||
line << ';' << aps[1].get_mac_addr() ;
|
line << ';' << aps[1].get_mac_addr() ;
|
||||||
|
line << ';' << 2 ;
|
||||||
line << ';' << calibration_request->get_measurements()
|
line << ';' << calibration_request->get_measurements()
|
||||||
.at(aps[1].get_mac_addr()).get_ss(2) ;
|
.at(aps[1].get_mac_addr()).get_ss(2) ;
|
||||||
line << ';' << aps[0].get_mac_addr() ;
|
line << ';' << aps[0].get_mac_addr() ;
|
||||||
|
line << ';' << 2 ;
|
||||||
line << ';' << calibration_request->get_measurements()
|
line << ';' << calibration_request->get_measurements()
|
||||||
.at(aps[0].get_mac_addr()).get_ss(2) ;
|
.at(aps[0].get_mac_addr()).get_ss(2) ;
|
||||||
line << '\n' ;
|
line << '\n' ;
|
||||||
|
@ -249,22 +290,30 @@ create_test_csv_file(const string &file_name, bool with_spaces)
|
||||||
line.str("") ;
|
line.str("") ;
|
||||||
if (with_spaces)
|
if (with_spaces)
|
||||||
line << '\t' ;
|
line << '\t' ;
|
||||||
line << mobiles[0].get_mac_addr() ;
|
line << csv_format ;
|
||||||
|
line << ';' << mobiles[0].get_mac_addr() ;
|
||||||
|
line << ';' << static_cast<uint_fast16_t>(requests.at(2)->get_type()) ;
|
||||||
|
line << ';' << requests.at(2)->get_nb_packets() ;
|
||||||
line << ';' << requests.at(2)->get_time_sent() ;
|
line << ';' << requests.at(2)->get_time_sent() ;
|
||||||
line << ";0;0;0;0;" ;
|
line << ";0;0;0;0;" ;
|
||||||
line << aps[2].get_mac_addr() ;
|
line << aps[2].get_mac_addr() ;
|
||||||
|
line << ';' << 1 ;
|
||||||
line << ';' << requests.at(2)->get_measurements()
|
line << ';' << requests.at(2)->get_measurements()
|
||||||
.at(aps[2].get_mac_addr()).get_ss(1) ;
|
.at(aps[2].get_mac_addr()).get_ss(1) ;
|
||||||
line << ';' << aps[1].get_mac_addr() ;
|
line << ';' << aps[1].get_mac_addr() ;
|
||||||
|
line << ';' << 1 ;
|
||||||
line << ';' << requests.at(2)->get_measurements()
|
line << ';' << requests.at(2)->get_measurements()
|
||||||
.at(aps[1].get_mac_addr()).get_ss(1) ;
|
.at(aps[1].get_mac_addr()).get_ss(1) ;
|
||||||
line << ';' << aps[0].get_mac_addr() ;
|
line << ';' << aps[0].get_mac_addr() ;
|
||||||
|
line << ';' << 1 ;
|
||||||
line << ';' << requests.at(2)->get_measurements()
|
line << ';' << requests.at(2)->get_measurements()
|
||||||
.at(aps[0].get_mac_addr()).get_ss(1) ;
|
.at(aps[0].get_mac_addr()).get_ss(1) ;
|
||||||
line << ';' << aps[1].get_mac_addr() ;
|
line << ';' << aps[1].get_mac_addr() ;
|
||||||
|
line << ';' << 2 ;
|
||||||
line << ';' << requests.at(2)->get_measurements()
|
line << ';' << requests.at(2)->get_measurements()
|
||||||
.at(aps[1].get_mac_addr()).get_ss(2) ;
|
.at(aps[1].get_mac_addr()).get_ss(2) ;
|
||||||
line << ';' << aps[0].get_mac_addr() ;
|
line << ';' << aps[0].get_mac_addr() ;
|
||||||
|
line << ';' << 2 ;
|
||||||
line << ';' << requests.at(2)->get_measurements()
|
line << ';' << requests.at(2)->get_measurements()
|
||||||
.at(aps[0].get_mac_addr()).get_ss(2) ;
|
.at(aps[0].get_mac_addr()).get_ss(2) ;
|
||||||
line << '\n' ;
|
line << '\n' ;
|
||||||
|
|
|
@ -19,6 +19,7 @@ private:
|
||||||
static void create_cp_list(void) ;
|
static void create_cp_list(void) ;
|
||||||
static void create_request_list(void) ;
|
static void create_request_list(void) ;
|
||||||
static void create_result_list(void) ;
|
static void create_result_list(void) ;
|
||||||
|
static void setup_configuration(void) ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static std::vector<CapturePoint> aps ;
|
static std::vector<CapturePoint> aps ;
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
output_file.close() ;
|
output_file.close() ;
|
||||||
|
|
||||||
std::string line ;
|
std::string line ;
|
||||||
TextFileReader *textfilereader ;
|
TextFileReader *textfilereader = NULL ;
|
||||||
TS_ASSERT_THROWS_NOTHING(
|
TS_ASSERT_THROWS_NOTHING(
|
||||||
textfilereader = new TextFileReader(test_file_name)) ;
|
textfilereader = new TextFileReader(test_file_name)) ;
|
||||||
TS_ASSERT(textfilereader->read_line(line)) ;
|
TS_ASSERT(textfilereader->read_line(line)) ;
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
|
|
||||||
void test_textfilewriter(void)
|
void test_textfilewriter(void)
|
||||||
{
|
{
|
||||||
TextFileWriter *textfilewriter ;
|
TextFileWriter *textfilewriter = NULL ;
|
||||||
TS_ASSERT_THROWS_NOTHING(
|
TS_ASSERT_THROWS_NOTHING(
|
||||||
textfilewriter = new TextFileWriter(test_file_name)) ;
|
textfilewriter = new TextFileWriter(test_file_name)) ;
|
||||||
TS_ASSERT(textfilewriter->write_text("Hello\nWorld\n")) ;
|
TS_ASSERT(textfilewriter->write_text("Hello\nWorld\n")) ;
|
||||||
|
|
|
@ -39,7 +39,8 @@ public:
|
||||||
TS_ASSERT_EQUALS(timestamp1, timestamp4) ;
|
TS_ASSERT_EQUALS(timestamp1, timestamp4) ;
|
||||||
|
|
||||||
// Equality
|
// Equality
|
||||||
TS_ASSERT_EQUALS(static_cast<struct timespec>(timestamp1), timespec1) ;
|
TS_ASSERT_EQUALS(static_cast<struct timespec>(timestamp1),
|
||||||
|
timespec1) ;
|
||||||
TS_ASSERT_EQUALS(timestamp1, timespec1) ;
|
TS_ASSERT_EQUALS(timestamp1, timespec1) ;
|
||||||
TS_ASSERT_EQUALS(static_cast<uint64_t>(timestamp1), msec) ;
|
TS_ASSERT_EQUALS(static_cast<uint64_t>(timestamp1), msec) ;
|
||||||
TS_ASSERT_EQUALS(timestamp1, msec) ;
|
TS_ASSERT_EQUALS(timestamp1, msec) ;
|
||||||
|
@ -48,7 +49,7 @@ public:
|
||||||
void test_non_zero(void)
|
void test_non_zero(void)
|
||||||
{
|
{
|
||||||
uint64_t sec = 1234567 ;
|
uint64_t sec = 1234567 ;
|
||||||
uint64_t nsec = 891234567 ; // Do not put a value >= 1 sec. for the test!
|
uint64_t nsec = 891234567 ; // Don't put a value >= 1 sec. for the test!
|
||||||
uint64_t msec = sec * 1000 + nsec / 1000000 ;
|
uint64_t msec = sec * 1000 + nsec / 1000000 ;
|
||||||
struct timespec timespec1 ;
|
struct timespec timespec1 ;
|
||||||
timespec1.tv_sec = sec ;
|
timespec1.tv_sec = sec ;
|
||||||
|
@ -56,19 +57,23 @@ public:
|
||||||
|
|
||||||
// struct timespec constructor
|
// struct timespec constructor
|
||||||
Timestamp timestamp1(timespec1) ;
|
Timestamp timestamp1(timespec1) ;
|
||||||
timespec1.tv_nsec = nsec / 1000000 * 1000000 ; // Round to ms
|
TS_ASSERT_EQUALS(static_cast<struct timespec>(timestamp1),
|
||||||
TS_ASSERT_EQUALS(static_cast<struct timespec>(timestamp1), timespec1) ;
|
timespec1) ;
|
||||||
TS_ASSERT_EQUALS(timestamp1, timespec1) ;
|
TS_ASSERT_EQUALS(timestamp1, timespec1) ;
|
||||||
TS_ASSERT_EQUALS(static_cast<uint64_t>(timestamp1), msec) ;
|
TS_ASSERT_EQUALS(static_cast<uint64_t>(timestamp1), msec) ;
|
||||||
TS_ASSERT_EQUALS(timestamp1, msec) ;
|
TS_ASSERT_EQUALS(timestamp1, msec) ;
|
||||||
|
|
||||||
// ms constructor
|
// ms constructor (deprecated)
|
||||||
Timestamp timestamp2(msec) ;
|
Timestamp timestamp2(msec) ;
|
||||||
TS_ASSERT_EQUALS(static_cast<struct timespec>(timestamp2), timespec1) ;
|
timespec1.tv_nsec = nsec / 1000000 * 1000000 ; // Round to ms
|
||||||
|
TS_ASSERT_EQUALS(static_cast<struct timespec>(timestamp2),
|
||||||
|
timespec1) ;
|
||||||
TS_ASSERT_EQUALS(timestamp2, timespec1) ;
|
TS_ASSERT_EQUALS(timestamp2, timespec1) ;
|
||||||
TS_ASSERT_EQUALS(static_cast<uint64_t>(timestamp2), msec) ;
|
TS_ASSERT_EQUALS(static_cast<uint64_t>(timestamp2), msec) ;
|
||||||
TS_ASSERT_EQUALS(timestamp2, msec) ;
|
TS_ASSERT_EQUALS(timestamp2, msec) ;
|
||||||
TS_ASSERT_EQUALS(timestamp1, timestamp2) ;
|
|
||||||
|
// ms and ns give different values
|
||||||
|
TS_ASSERT_DIFFERS(timestamp1, timestamp2) ;
|
||||||
|
|
||||||
// Copy constructor
|
// Copy constructor
|
||||||
Timestamp timestamp3(timestamp1) ;
|
Timestamp timestamp3(timestamp1) ;
|
||||||
|
@ -77,6 +82,8 @@ public:
|
||||||
|
|
||||||
void test_current_time(void)
|
void test_current_time(void)
|
||||||
{
|
{
|
||||||
|
// Note: we could test update_current_time() in replay mode.
|
||||||
|
|
||||||
Timestamp timestamp1 ;
|
Timestamp timestamp1 ;
|
||||||
struct timespec current_time ;
|
struct timespec current_time ;
|
||||||
|
|
||||||
|
@ -86,18 +93,28 @@ public:
|
||||||
TS_FAIL("Error getting current time!") ;
|
TS_FAIL("Error getting current time!") ;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
const Timestamp &now = Timestamp::get_current_time() ;
|
||||||
Timestamp timestamp2(current_time) ;
|
Timestamp timestamp2(current_time) ;
|
||||||
|
|
||||||
TS_ASSERT_DELTA(static_cast<uint64_t>(timestamp1),
|
TS_ASSERT_DELTA(static_cast<uint64_t>(timestamp1),
|
||||||
static_cast<uint64_t>(timestamp2),
|
static_cast<uint64_t>(timestamp2),
|
||||||
100) ;
|
100) ;
|
||||||
|
TS_ASSERT_DELTA(static_cast<uint64_t>(timestamp2),
|
||||||
|
static_cast<uint64_t>(now),
|
||||||
|
100) ;
|
||||||
|
|
||||||
// The following tests may fail if the ns value is a ms
|
TS_ASSERT_DIFFERS(static_cast<struct timespec>(timestamp1),
|
||||||
TS_ASSERT_DIFFERS(static_cast<struct timespec>(timestamp1), current_time) ;
|
current_time) ;
|
||||||
TS_ASSERT(timestamp1 != current_time) ;
|
TS_ASSERT_EQUALS(static_cast<struct timespec>(timestamp2),
|
||||||
TS_ASSERT_DIFFERS(static_cast<struct timespec>(timestamp2), current_time) ;
|
current_time) ;
|
||||||
TS_ASSERT(timestamp2 != current_time) ;
|
|
||||||
|
// elapsed()
|
||||||
|
Timestamp elapsed11(timestamp1.elapsed(timestamp1)) ;
|
||||||
|
TS_ASSERT_EQUALS(static_cast<uint64_t>(elapsed11), 0) ;
|
||||||
|
TS_ASSERT(! elapsed11) ;
|
||||||
|
Timestamp elapsed12(timestamp1.elapsed(timestamp2)) ;
|
||||||
|
TS_ASSERT(static_cast<uint64_t>(elapsed12) < 100) ;
|
||||||
|
Timestamp elapsed21(timestamp2.elapsed(timestamp1)) ;
|
||||||
|
TS_ASSERT_EQUALS(elapsed12, elapsed21) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_affectation(void)
|
void test_affectation(void)
|
||||||
|
@ -111,26 +128,28 @@ public:
|
||||||
|
|
||||||
// struct timespec constructor
|
// struct timespec constructor
|
||||||
Timestamp timestamp1(current_time) ;
|
Timestamp timestamp1(current_time) ;
|
||||||
TS_ASSERT_DIFFERS(static_cast<struct timespec>(timestamp1), current_time) ;
|
TS_ASSERT_EQUALS(static_cast<struct timespec>(timestamp1),
|
||||||
TS_ASSERT(timestamp1 != current_time) ;
|
current_time) ;
|
||||||
|
|
||||||
// ms constructor
|
// ms constructor (deprecated)
|
||||||
current_time.tv_nsec = current_time.tv_nsec / 1000000 * 1000000 ;
|
current_time.tv_nsec = current_time.tv_nsec / 1000000 * 1000000 ;
|
||||||
uint64_t msec = timestamp1 ;
|
uint64_t msec = timestamp1 ;
|
||||||
Timestamp timestamp2(msec) ;
|
Timestamp timestamp2(msec) ;
|
||||||
TS_ASSERT_EQUALS(static_cast<uint64_t>(timestamp2), msec) ;
|
TS_ASSERT_EQUALS(static_cast<uint64_t>(timestamp2), msec) ;
|
||||||
TS_ASSERT_EQUALS(timestamp2, msec) ;
|
TS_ASSERT_EQUALS(timestamp2, msec) ;
|
||||||
TS_ASSERT_EQUALS(static_cast<struct timespec>(timestamp2), current_time) ;
|
TS_ASSERT_EQUALS(static_cast<struct timespec>(timestamp2),
|
||||||
|
current_time) ;
|
||||||
TS_ASSERT_EQUALS(timestamp2, current_time) ;
|
TS_ASSERT_EQUALS(timestamp2, current_time) ;
|
||||||
|
|
||||||
// Affectation
|
// Affectation
|
||||||
++current_time.tv_sec ;
|
++current_time.tv_sec ;
|
||||||
timestamp2 = current_time ;
|
timestamp2 = current_time ;
|
||||||
TS_ASSERT(timestamp1 != timestamp2) ;
|
TS_ASSERT_DIFFERS(timestamp1, timestamp2) ;
|
||||||
msec = timestamp2 ;
|
msec = timestamp2 ;
|
||||||
TS_ASSERT_EQUALS(static_cast<uint64_t>(timestamp2), msec) ;
|
TS_ASSERT_EQUALS(static_cast<uint64_t>(timestamp2), msec) ;
|
||||||
TS_ASSERT_EQUALS(timestamp2, msec) ;
|
TS_ASSERT_EQUALS(timestamp2, msec) ;
|
||||||
TS_ASSERT_EQUALS(static_cast<struct timespec>(timestamp2), current_time) ;
|
TS_ASSERT_EQUALS(static_cast<struct timespec>(timestamp2),
|
||||||
|
current_time) ;
|
||||||
TS_ASSERT_EQUALS(timestamp2, current_time) ;
|
TS_ASSERT_EQUALS(timestamp2, current_time) ;
|
||||||
|
|
||||||
msec = 1234567891234ull ;
|
msec = 1234567891234ull ;
|
||||||
|
@ -138,7 +157,8 @@ public:
|
||||||
TS_ASSERT_EQUALS(static_cast<uint64_t>(timestamp2), msec) ;
|
TS_ASSERT_EQUALS(static_cast<uint64_t>(timestamp2), msec) ;
|
||||||
TS_ASSERT_EQUALS(timestamp2, msec) ;
|
TS_ASSERT_EQUALS(timestamp2, msec) ;
|
||||||
current_time = timestamp2 ;
|
current_time = timestamp2 ;
|
||||||
TS_ASSERT_EQUALS(static_cast<struct timespec>(timestamp2), current_time) ;
|
TS_ASSERT_EQUALS(static_cast<struct timespec>(timestamp2),
|
||||||
|
current_time) ;
|
||||||
TS_ASSERT_EQUALS(timestamp2, current_time) ;
|
TS_ASSERT_EQUALS(timestamp2, current_time) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,17 +190,17 @@ public:
|
||||||
TS_ASSERT(! (today > today_timespec)) ;
|
TS_ASSERT(! (today > today_timespec)) ;
|
||||||
TS_ASSERT(! (today < today_timespec)) ;
|
TS_ASSERT(! (today < today_timespec)) ;
|
||||||
|
|
||||||
TS_ASSERT(today != yesterday) ;
|
TS_ASSERT_DIFFERS(today, yesterday) ;
|
||||||
TS_ASSERT_LESS_THAN(yesterday, today) ;
|
TS_ASSERT_LESS_THAN(yesterday, today) ;
|
||||||
TS_ASSERT_LESS_THAN_EQUALS(yesterday, today) ;
|
TS_ASSERT_LESS_THAN_EQUALS(yesterday, today) ;
|
||||||
TS_ASSERT(! (yesterday > today)) ;
|
TS_ASSERT(! (yesterday > today)) ;
|
||||||
TS_ASSERT(! (yesterday >= today)) ;
|
TS_ASSERT(! (yesterday >= today)) ;
|
||||||
TS_ASSERT(today != yesterday_int) ;
|
TS_ASSERT_DIFFERS(today, yesterday_int) ;
|
||||||
TS_ASSERT_LESS_THAN(yesterday, today_int) ;
|
TS_ASSERT_LESS_THAN(yesterday, today_int) ;
|
||||||
TS_ASSERT_LESS_THAN_EQUALS(yesterday, today_int) ;
|
TS_ASSERT_LESS_THAN_EQUALS(yesterday, today_int) ;
|
||||||
TS_ASSERT(! (yesterday > today_int)) ;
|
TS_ASSERT(! (yesterday > today_int)) ;
|
||||||
TS_ASSERT(! (yesterday >= today_int)) ;
|
TS_ASSERT(! (yesterday >= today_int)) ;
|
||||||
TS_ASSERT(today != yesterday_timespec) ;
|
TS_ASSERT_DIFFERS(today, yesterday_timespec) ;
|
||||||
TS_ASSERT_LESS_THAN(yesterday, today_timespec) ;
|
TS_ASSERT_LESS_THAN(yesterday, today_timespec) ;
|
||||||
TS_ASSERT_LESS_THAN_EQUALS(yesterday, today_timespec) ;
|
TS_ASSERT_LESS_THAN_EQUALS(yesterday, today_timespec) ;
|
||||||
TS_ASSERT(! (yesterday > today_timespec)) ;
|
TS_ASSERT(! (yesterday > today_timespec)) ;
|
||||||
|
@ -198,9 +218,9 @@ public:
|
||||||
Timestamp today ;
|
Timestamp today ;
|
||||||
today.now() ;
|
today.now() ;
|
||||||
|
|
||||||
TS_ASSERT(today != zero) ;
|
TS_ASSERT_DIFFERS(today, zero) ;
|
||||||
TS_ASSERT(today != zero_timespec) ;
|
TS_ASSERT_DIFFERS(today, zero_timespec) ;
|
||||||
TS_ASSERT(today != zero_timestamp) ;
|
TS_ASSERT_DIFFERS(today, zero_timestamp) ;
|
||||||
|
|
||||||
today.clear() ;
|
today.clear() ;
|
||||||
TS_ASSERT_EQUALS(today, zero) ;
|
TS_ASSERT_EQUALS(today, zero) ;
|
||||||
|
|
|
@ -14,8 +14,6 @@ public:
|
||||||
areas_file_name("/tmp/TopologyReaderCSV_areas_file.csv"),
|
areas_file_name("/tmp/TopologyReaderCSV_areas_file.csv"),
|
||||||
waypoints_file_name("/tmp/TopologyReaderCSV_waypoints_file.csv")
|
waypoints_file_name("/tmp/TopologyReaderCSV_waypoints_file.csv")
|
||||||
{
|
{
|
||||||
Stock::clear() ;
|
|
||||||
|
|
||||||
std::ofstream areas_file(areas_file_name.c_str()) ;
|
std::ofstream areas_file(areas_file_name.c_str()) ;
|
||||||
areas_file
|
areas_file
|
||||||
<< "My building;My room #1;1;2;3;9;8;7\n"
|
<< "My building;My room #1;1;2;3;9;8;7\n"
|
||||||
|
@ -43,7 +41,6 @@ public:
|
||||||
|
|
||||||
~TopologyReaderCSV_test(void)
|
~TopologyReaderCSV_test(void)
|
||||||
{
|
{
|
||||||
Stock::clear() ;
|
|
||||||
TestUtil::remove_file(areas_file_name) ;
|
TestUtil::remove_file(areas_file_name) ;
|
||||||
TestUtil::remove_file(waypoints_file_name) ;
|
TestUtil::remove_file(waypoints_file_name) ;
|
||||||
}
|
}
|
||||||
|
@ -63,11 +60,11 @@ public:
|
||||||
|
|
||||||
void test_areas(void)
|
void test_areas(void)
|
||||||
{
|
{
|
||||||
Building *building1 ;
|
Building *building1 = NULL ;
|
||||||
TS_ASSERT_THROWS_NOTHING(
|
TS_ASSERT_THROWS_NOTHING(
|
||||||
building1 = const_cast<Building*>(
|
building1 = const_cast<Building*>(
|
||||||
&Stock::get_building("My building"))) ;
|
&Stock::get_building("My building"))) ;
|
||||||
Building *building2 ;
|
Building *building2 = NULL ;
|
||||||
TS_ASSERT_THROWS_NOTHING(
|
TS_ASSERT_THROWS_NOTHING(
|
||||||
building2 = const_cast<Building*>(
|
building2 = const_cast<Building*>(
|
||||||
&Stock::get_building("Building #2"))) ;
|
&Stock::get_building("Building #2"))) ;
|
||||||
|
@ -97,11 +94,11 @@ public:
|
||||||
|
|
||||||
void test_waypoints(void)
|
void test_waypoints(void)
|
||||||
{
|
{
|
||||||
Building *building1 ;
|
Building *building1 = NULL ;
|
||||||
TS_ASSERT_THROWS_NOTHING(
|
TS_ASSERT_THROWS_NOTHING(
|
||||||
building1 = const_cast<Building*>(
|
building1 = const_cast<Building*>(
|
||||||
&Stock::get_building("My building"))) ;
|
&Stock::get_building("My building"))) ;
|
||||||
Building *building2 ;
|
Building *building2 = NULL ;
|
||||||
TS_ASSERT_THROWS_NOTHING(
|
TS_ASSERT_THROWS_NOTHING(
|
||||||
building2 = const_cast<Building*>(
|
building2 = const_cast<Building*>(
|
||||||
&Stock::get_building("Building #2"))) ;
|
&Stock::get_building("Building #2"))) ;
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
} ;
|
} ;
|
||||||
int argc = 3 ;
|
int argc = 3 ;
|
||||||
|
|
||||||
UserInterface ui(argc, const_cast<char**>(argv)) ;
|
UserInterface ui(argc, argv) ;
|
||||||
|
|
||||||
TS_ASSERT(Configuration::is_configured("input.udp-port")) ;
|
TS_ASSERT(Configuration::is_configured("input.udp-port")) ;
|
||||||
TS_ASSERT(Configuration::is_configured("config-file")) ;
|
TS_ASSERT(Configuration::is_configured("config-file")) ;
|
||||||
|
|
Loading…
Reference in New Issue