2015-07-29 23:48:29 +00:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "doorkeeper/primitivetypes.hpp"
|
|
|
|
|
|
|
|
TEST(misc, vector) {
|
2015-07-30 14:12:12 +00:00
|
|
|
typedef dk::Vector<2> coords2;
|
|
|
|
typedef dk::Vector<8> coords8;
|
2015-07-29 23:48:29 +00:00
|
|
|
|
2015-07-30 14:12:12 +00:00
|
|
|
{
|
2015-07-29 23:48:29 +00:00
|
|
|
const coords2 small(5, 6);
|
|
|
|
EXPECT_EQ(small.x(), 5);
|
|
|
|
EXPECT_EQ(small.y(), 6);
|
|
|
|
|
|
|
|
const coords2 med(1200, 4000);
|
|
|
|
EXPECT_LT(small, med);
|
|
|
|
EXPECT_LE(small, med);
|
|
|
|
EXPECT_GT(med, small);
|
|
|
|
EXPECT_GE(med, small);
|
|
|
|
|
|
|
|
const coords2 big(10000, 12345);
|
|
|
|
EXPECT_GT(big, med);
|
|
|
|
EXPECT_GT(big, small);
|
|
|
|
EXPECT_LT(small, big);
|
|
|
|
|
|
|
|
const coords2 med2_a(1200, 4001);
|
|
|
|
EXPECT_LE(med, med2_a);
|
|
|
|
EXPECT_GE(med2_a, med);
|
|
|
|
|
|
|
|
EXPECT_FALSE(med2_a < med);
|
|
|
|
EXPECT_FALSE(med2_a == med);
|
|
|
|
EXPECT_FALSE(med > med2_a);
|
|
|
|
}
|
2015-07-30 14:12:12 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
const coords8 small(1, 2, 3, 4, 5, 6, 7, 8);
|
|
|
|
const coords8 big(small * 100);
|
2015-08-14 10:32:52 +00:00
|
|
|
for (int z = 0; z < coords8::dimensions; ++z) {
|
2015-07-30 14:12:12 +00:00
|
|
|
EXPECT_EQ(big[z], (z + 1) * 100);
|
|
|
|
}
|
|
|
|
|
|
|
|
EXPECT_LT(small, big);
|
|
|
|
}
|
2015-07-29 23:48:29 +00:00
|
|
|
}
|