Welcome to mirror list, hosted at ThFree Co, Russian Federation.

location_test.cpp « platform_tests « platform - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3c79dba77c76aa75a74ece61733455ca754b5f7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "../../testing/testing.hpp"

#include "../location.hpp"


UNIT_TEST(IsLatValid)
{
  TEST(location::IsLatValid(35.), ());
  TEST(location::IsLatValid(-35.), ());
  TEST(!location::IsLatValid(0.), ());
  TEST(!location::IsLatValid(100.), ());
  TEST(!location::IsLatValid(-99.), ());
}

UNIT_TEST(IsLonValid)
{
  TEST(location::IsLonValid(135.), ());
  TEST(location::IsLonValid(-35.), ());
  TEST(!location::IsLonValid(0.), ());
  TEST(!location::IsLonValid(200.), ());
  TEST(!location::IsLonValid(-199.), ());
}

UNIT_TEST(AngleToBearing)
{
  TEST_ALMOST_EQUAL(location::AngleToBearing(0.), 90., ());
  TEST_ALMOST_EQUAL(location::AngleToBearing(30.), 60., ());
  TEST_ALMOST_EQUAL(location::AngleToBearing(100.), 350., ());
  TEST_ALMOST_EQUAL(location::AngleToBearing(370.), 80., ());
  TEST_ALMOST_EQUAL(location::AngleToBearing(-370.), 100., ());
}

UNIT_TEST(BearingToAngle)
{
  TEST_ALMOST_EQUAL(location::BearingToAngle(0.), 90., ());
  TEST_ALMOST_EQUAL(location::BearingToAngle(30.), 60., ());
  TEST_ALMOST_EQUAL(location::BearingToAngle(100.), 350., ());
  TEST_ALMOST_EQUAL(location::BearingToAngle(370.), 80., ());
  TEST_ALMOST_EQUAL(location::AngleToBearing(-370.), 100., ());
}