~ci-train-bot/location-service/location-service-ubuntu-yakkety-1895

« back to all changes in this revision

Viewing changes to tests/accuracy_tests.cpp

  • Committer: Thomas Voß
  • Date: 2013-05-28 14:20:45 UTC
  • Revision ID: thomas.voss@canonical.com-20130528142045-kq5umqdmm4o53vwk
Initial push.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "com/ubuntu/location/accuracy.h"
 
2
 
 
3
#include "com/ubuntu/location/heading.h"
 
4
#include "com/ubuntu/location/velocity.h"
 
5
#include "com/ubuntu/location/wgs84/altitude.h"
 
6
#include "com/ubuntu/location/wgs84/latitude.h"
 
7
#include "com/ubuntu/location/wgs84/longitude.h"
 
8
 
 
9
#include <gtest/gtest.h>
 
10
 
 
11
namespace cul = com::ubuntu::location;
 
12
 
 
13
TEST(HeadingAccuracy, classification_of_min_and_max_values_works_correctly)
 
14
{
 
15
    cul::Accuracy<cul::Heading> acc_max{cul::Heading{cul::Heading::max()}};
 
16
    EXPECT_EQ(cul::AccuracyLevel::worst, acc_max.classify());
 
17
 
 
18
    cul::Accuracy<cul::Heading> acc_min{cul::Heading{cul::Heading::min()}};
 
19
    EXPECT_EQ(cul::AccuracyLevel::best, acc_min.classify());
 
20
 
 
21
    EXPECT_EQ(cul::AccuracyLevel::best, cul::Accuracy<cul::Heading>::best().classify());
 
22
    EXPECT_EQ(cul::AccuracyLevel::worst, cul::Accuracy<cul::Heading>::worst().classify());
 
23
}
 
24
 
 
25
TEST(VelocityAccuracy, classification_of_min_and_max_values_works_correctly)
 
26
{
 
27
    cul::Accuracy<cul::Velocity> acc_max{cul::Velocity{cul::Velocity::max()}};
 
28
    EXPECT_EQ(cul::AccuracyLevel::worst, acc_max.classify());
 
29
 
 
30
    cul::Accuracy<cul::Velocity> acc_min{cul::Velocity{cul::Velocity::min()}};
 
31
    EXPECT_EQ(cul::AccuracyLevel::best, acc_min.classify());
 
32
 
 
33
    EXPECT_EQ(cul::AccuracyLevel::best, cul::Accuracy<cul::Velocity>::best().classify());
 
34
    EXPECT_EQ(cul::AccuracyLevel::worst, cul::Accuracy<cul::Velocity>::worst().classify());
 
35
}