1
#include "com/ubuntu/location/heading.h"
3
#include <gtest/gtest.h>
5
TEST(Heading, constructing_a_heading_with_invalid_value_throws)
7
EXPECT_ANY_THROW(com::ubuntu::location::Heading h {-std::numeric_limits<double>::min()*com::ubuntu::location::units::Degrees};);
8
EXPECT_ANY_THROW(com::ubuntu::location::Heading h {361.*com::ubuntu::location::units::Degrees};);
11
TEST(Heading, constructing_a_heading_with_a_valid_value_does_not_throw)
13
std::default_random_engine rng;
14
std::uniform_real_distribution<double> dist(com::ubuntu::location::Heading::min().value(),
15
com::ubuntu::location::Heading::max().value());
17
EXPECT_NO_THROW(com::ubuntu::location::Heading h {dist(rng)*com::ubuntu::location::units::Degrees};);
20
TEST(Heading, a_heading_contains_value_passed_at_construction)
22
std::default_random_engine rng;
23
std::uniform_real_distribution<double> dist(com::ubuntu::location::Heading::min().value(),
24
com::ubuntu::location::Heading::max().value());
26
com::ubuntu::location::Heading h {d* com::ubuntu::location::units::Degrees};
27
EXPECT_EQ(d * com::ubuntu::location::units::Degrees, h.value);