diff --git a/3party/3party.pro b/3party/3party.pro index e6a6a21bb7..5d9b8d4143 100644 --- a/3party/3party.pro +++ b/3party/3party.pro @@ -7,7 +7,7 @@ SUBDIRS = freetype fribidi minizip jansson tomcrypt protobuf osrm expat \ !linux* { SUBDIRS += opening_hours \ - + opening_hours/opening_hours_tests \ } !iphone*:!tizen*:!android* { diff --git a/3party/opening_hours/opening_hours_tests/opening_hours_tests.pro b/3party/opening_hours/opening_hours_tests/opening_hours_tests.pro new file mode 100644 index 0000000000..7cfa4c0d23 --- /dev/null +++ b/3party/opening_hours/opening_hours_tests/opening_hours_tests.pro @@ -0,0 +1,15 @@ + +TARGET = opening_hours_tests +CONFIG += console worn_off +CONFIG -= app_bundle +TEMPLATE = app + +ROOT_DIR = ../../.. +DEPENDENCIES = opening_hours + +include($$ROOT_DIR/common.pri) + +INCLUDEPATH += $$ROOT_DIR/3party/opening_hours + +SOURCES += osm_time_range_tests.cpp +SOURCES += ../osm_time_range.hpp diff --git a/3party/opening_hours/osm_time_range_tests.cpp b/3party/opening_hours/opening_hours_tests/osm_time_range_tests.cpp similarity index 99% rename from 3party/opening_hours/osm_time_range_tests.cpp rename to 3party/opening_hours/opening_hours_tests/osm_time_range_tests.cpp index 9a222bcd35..847a3dd4e8 100644 --- a/3party/opening_hours/osm_time_range_tests.cpp +++ b/3party/opening_hours/opening_hours_tests/osm_time_range_tests.cpp @@ -198,7 +198,7 @@ BOOST_AUTO_TEST_CASE(OpeningHours_TimeHit) BOOST_AUTO_TEST_CASE(OpeningHours_StaticSet) { { - OSMTimeRange oh("06:00-02:00/21:03"); + OSMTimeRange oh("06:00-02:00/21:03"); // interval is greater than smth BOOST_CHECK(oh.IsValid()); } @@ -327,7 +327,7 @@ BOOST_AUTO_TEST_CASE(OpeningHours_StaticSet) BOOST_CHECK(oh.IsValid()); } { - OSMTimeRange oh("Пн. — пт.: 09:00 — 21:00; сб.: 09:00 — 19:00"); + OSMTimeRange oh("Пн. — пт.: 09:00 — 21:00; сб.: 09:00 — 19:00"); // Пн -> пн BOOST_CHECK(oh.IsValid()); } { @@ -505,4 +505,4 @@ BOOST_AUTO_TEST_CASE( OpeningHours_CountFailed ) desc_message << "Weight: " << e.first << " Count: " << e.second << std::endl; } BOOST_TEST_MESSAGE(desc_message.str()); -} \ No newline at end of file +} diff --git a/3party/opening_hours/osm_time_range.cpp b/3party/opening_hours/osm_time_range.cpp index ee411e5261..0092d08bda 100644 --- a/3party/opening_hours/osm_time_range.cpp +++ b/3party/opening_hours/osm_time_range.cpp @@ -527,7 +527,8 @@ namespace holyday %= (charset::no_case[lit(L"SH")] >> -day_offset) | charset::no_case[lit(L"PH")]; holiday_sequence %= holyday % ','; weekday_range = (charset::no_case[wdays][at_c<0>(_val) |= (1<<_1)] - >> L'[' >> nth_entry[at_c<1>(_val) |= _1] % L',' >> L']' >> day_offset[at_c<2>(_val) = _1]) + >> L'[' >> nth_entry[at_c<1>(_val) |= _1] % L',' + >> L']' >> day_offset[at_c<2>(_val) = _1]) | (charset::no_case[wdays][at_c<0>(_val) |= (1<<_1)] >> L'[' >> nth_entry[at_c<1>(_val) |= _1] % L',' >> L']') | charset::no_case[(wdays >> dash >> wdays)] [at_c<0>(_val) |= ((2 << ((_2)-(_1))) - 1) << (_1)] | charset::no_case[wdays][at_c<0>(_val) |= (1<<_1)] @@ -874,7 +875,7 @@ namespace } if (!next) return next; - + next = r.timespan.empty(); for (auto const & ts : r.timespan) { @@ -901,8 +902,8 @@ OSMTimeRange::OSMTimeRange(std::string const & rules) void OSMTimeRange::parse() { - std::wstring_convert> converter; - std::wstring src = converter.from_bytes(m_sourceString); + std::wstring_convert> converter; // could not work on android + std::wstring src = converter.from_bytes(m_sourceString); // m_sourceString should be wstring m_valid = parse_timerange(src.begin(), src.end(), m_rules); }