huge commit
- worked on about everything - grid walker using plugable modules - wifi models - new distributions - worked on geometric data-structures - added typesafe timestamps - worked on grid-building - added sensor-classes - added sensor analysis (step-detection, turn-detection) - offline data reader - many test-cases
This commit is contained in:
55
tests/data/TestTimestamp.cpp
Normal file
55
tests/data/TestTimestamp.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#ifdef WITH_TESTS
|
||||
|
||||
#include "../Tests.h"
|
||||
#include "../../data/Timestamp.h"
|
||||
|
||||
TEST(Timestamp, convert) {
|
||||
|
||||
Timestamp ts1 = Timestamp::fromMS(100);
|
||||
ASSERT_EQ(100, ts1.ms());
|
||||
ASSERT_NEAR(0.1, ts1.sec(), 0.00001);
|
||||
|
||||
Timestamp ts2 = Timestamp::fromSec(0.1);
|
||||
ASSERT_EQ(100, ts2.ms());
|
||||
ASSERT_NEAR(0.1, ts2.sec(), 0.00001);
|
||||
|
||||
}
|
||||
|
||||
TEST(Timestamp, equal) {
|
||||
|
||||
Timestamp ts1 = Timestamp::fromMS(100);
|
||||
Timestamp ts2 = Timestamp::fromSec(0.1);
|
||||
|
||||
ASSERT_EQ(ts1, ts2);
|
||||
|
||||
}
|
||||
|
||||
TEST(Timestamp, comp) {
|
||||
|
||||
Timestamp ts1 = Timestamp::fromMS(100);
|
||||
Timestamp ts2 = Timestamp::fromSec(0.1);
|
||||
Timestamp ts3 = Timestamp::fromSec(150);
|
||||
|
||||
ASSERT_FALSE(ts1 < ts2);
|
||||
ASSERT_FALSE(ts1 > ts2);
|
||||
|
||||
ASSERT_TRUE(ts1 < ts3);
|
||||
ASSERT_FALSE(ts1 > ts3);
|
||||
|
||||
ASSERT_TRUE(ts3 > ts1);
|
||||
ASSERT_FALSE(ts3 < ts1);
|
||||
|
||||
}
|
||||
|
||||
TEST(Timestamp, add) {
|
||||
|
||||
Timestamp ts1 = Timestamp::fromMS(100);
|
||||
Timestamp ts2 = Timestamp::fromSec(0.2);
|
||||
|
||||
ASSERT_EQ(300, (ts1+ts2).ms());
|
||||
ASSERT_EQ(-100, (ts1-ts2).ms());
|
||||
ASSERT_EQ(+100, (ts2-ts1).ms());
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user