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

working_time_tests.cpp « map_tests « map - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d827e1475510c977e496cca31ba65777c6550a56 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "testing/testing.hpp"

#include "map/osm_opening_hours.hpp"

using namespace osm;

UNIT_TEST(WorkingTime_OpenSoon)
{
  // 1-jan-2000 08:50
  std::tm when = {};
  when.tm_mday = 1;
  when.tm_mon = 0;
  when.tm_year = 100;
  when.tm_hour = 8;
  when.tm_min = 50;

  time_t now = std::mktime(&when);

  TEST_EQUAL(PlaceStateCheck("09:00-21:00", now), EPlaceState::OpenSoon, ());
}

UNIT_TEST(WorkingTime_CloseSoon)
{
  // 1-jan-2000 20:50
  std::tm when = {};
  when.tm_mday = 1;
  when.tm_mon = 0;
  when.tm_year = 100;
  when.tm_hour = 20;
  when.tm_min = 50;

  time_t now = std::mktime(&when);
  TEST_EQUAL(PlaceStateCheck("09:00-21:00", now), EPlaceState::CloseSoon, ());
}

UNIT_TEST(WorkingTime_Open)
{
  // 1-jan-2000 13:50
  std::tm when = {};
  when.tm_mday = 1;
  when.tm_mon = 0;
  when.tm_year = 100;
  when.tm_hour = 13;
  when.tm_min = 50;

  time_t now = std::mktime(&when);
  TEST_EQUAL(PlaceStateCheck("09:00-21:00", now), EPlaceState::Open, ());
}

UNIT_TEST(WorkingTime_Closed)
{
  // 1-jan-2000 06:50
  std::tm when = {};
  when.tm_mday = 1;
  when.tm_mon = 0;
  when.tm_year = 100;
  when.tm_hour = 6;
  when.tm_min = 50;

  time_t now = std::mktime(&when);
  TEST_EQUAL(PlaceStateCheck("09:00-21:00", now), EPlaceState::Closed, ());
}