122 Commits

Author SHA1 Message Date
Howard Hinnant
ebb5719cd7 Change default test mode to C++17 2021-05-19 14:43:19 -04:00
Howard Hinnant
052eebaf00 When comparing sys_info in test...
only compare whether the saves are equal to 0
and not their actual values.

This allows one to compare against the binary database
which does not contain actual values of save.
2021-05-18 16:17:37 -04:00
Anthony Louis
6e921e1b1d Add tests for %I and %p format options 2021-04-16 21:26:33 -04:00
Howard Hinnant
ae017078c9 Fix Posix::time_zone for southern hemisphere
* The get_info functions were not prepared for the case where the start
  and end times of a rule are chronologically reversed for a year.  I.e.
  the daylight saving start comes later in the year than the daylight
  saving end.  When save is positive, this happens in the southern
  hemisphere (e.g. "Australia/Sydney" -> "AEST-10AEDT,M10.1.0,M4.1.0/3").
  It also happens in the nothern hemisphere when the save is negative
  (e.g. "Europe/Dublin" -> "IST-1GMT0,M10.5.0,M3.5.0/1").

* Added tests for Posix::time_zone.
2021-04-09 11:08:12 -04:00
Howard Hinnant
5e18488899 Fix subtle bug in fractional_width 2020-09-05 16:34:04 -04:00
Howard Hinnant
1ec2ea0295 Add test/tz_test/tzdb_list.pass.cpp 2020-08-17 21:34:20 -04:00
Asad. Gharighi
9cc3a7bca1 Adding Persian/Jalali/Solar-Hijri calendar 2020-03-08 20:18:45 -04:00
nanoric
66a5aa482e Add constexpr for clock_cast. 2020-01-11 14:44:06 -05:00
Lakshay Garg
018a50bcd0 Work around for a NVCC compiler bug
The NVCC compiler fails to compile the date library due
to a compiler bug which causes it to emit an error when
directly using std::ratio_{multiply,divide} in the template
instantiations for std::duration. This PR works around the
issue by introducing custom ratio_{multiply,divide} which
delegate to the standard library templates
2019-11-29 19:27:36 -05:00
Tomasz Kamiński
b87eb970c1 Implemented test for checking addition with classes converible to years/months
To work this specific test require current implementation
strategy (template with unspecified argument).
2019-09-03 22:52:31 -04:00
Tomasz Kamiński
5a0057587d Correct behavior for classes for which only lvalue is convertible to string_view.
Added OnlyLValueString test case that shows the problem with
current impl. Implemented the change, that accept TimeZonePtrOrName
by forwarding reference (to preserve value category), and
merged time_zone selection into one trait.
2019-09-01 14:43:50 -04:00
Tomasz Kamiński
5345d135b7 Implemented custom time zone deduction test.
Implemented test for deduction from the custom time zone ptr.
Used OffsetZone extracted for that purpose.
2019-09-01 14:43:50 -04:00
Tomasz Kamiński
1d721d9afd Implemented set of basic deduction test.
Implemented test for deduction from string, string_view,
time_zone ptr and other zoned_time.
2019-09-01 14:43:50 -04:00
Paul Dreik
6f0b645df1 #388 add comment on unit test failure (#442) 2019-07-21 20:47:33 -04:00
tomaszkam
e31daf8093 Unit tests for !year_month::ok() arithmetic. (#425) 2019-03-19 20:22:23 -04:00
Howard Hinnant
b5d025ea2f Align time_of_day with hh_mm_ss
Per committee review
2019-03-19 19:50:30 -04:00
Howard Hinnant
5a62c405e0 Remove unneeded make_precision 2019-02-03 23:21:36 -05:00
Howard Hinnant
9cb0013aef Update time_of_day to be more consistent ...
the needs of formatting.
2019-02-02 14:06:12 -05:00
Howard Hinnant
8f91ef27ed Revert "Model the TAI-UTC difference between 1961 and 1972"
This reverts commit 1eed461d06b02854d9310d5ab0198eccd2be1d1d.
2018-11-08 13:56:23 -08:00
Howard Hinnant
1eed461d06 Model the TAI-UTC difference between 1961 and 1972 2018-10-03 17:51:55 -04:00
Howard Hinnant
6a4d93a0bd Silence more shadow warnings 2018-07-01 23:00:33 -04:00
tomaszkam
e86edc3820 Added missing license to unit test files (#356) 2018-06-23 10:39:00 -04:00
tomaszkam
f46885e632 Suffix d for days duration (#354) 2018-06-20 11:39:48 -04:00
Tomasz Kamiński
2d282e35fa Use string_literal for C++11 when possible 2018-06-19 19:37:02 -04:00
tomaszkam
af2b2b70b3 Remove usage of octal literals in tests (#350)
* Remove usage of octal literals

* Fixed July
2018-06-12 13:18:18 -04:00
Howard Hinnant
0197889505 Update to Sunday constants 2018-06-11 15:14:44 -04:00
Tomasz Kamiński
b86def339e Test for utc during leap second insertion 2018-06-11 10:45:41 -04:00
Tomasz Kamiński
aa0494b980 custom clock and noncastable tests 2018-06-11 10:45:41 -04:00
Tomasz Kamiński
df31560701 Moved test to clock_cast_test dir 2018-06-11 10:45:41 -04:00
Tomasz Kamiński
4b687f4c04 Test is now C++11 compatible 2018-06-11 10:45:41 -04:00
Tomasz Kamiński
db60c5eb8e Unit test and typo fix 2018-06-11 10:45:41 -04:00
Howard Hinnant
40b83654b6 [API BREAKING] Remove conversion from weekday to unsigned
* There has been a great deal of anguish over the encoding of
  weekdays:  whether [0, 6] maps to [Sunday, Saturday] or
  [1, 7] maps to [Monday, Sunday].  This commit attempts
  to address that issue, but will break a small amount of
  code at compile-time.  See below on how to fix that.

* The weekday constructor used to accept [0, 6] to represent
  [Sunday, Saturday].  It now accepts [0, 7] to represent
  [Sunday, Saturday] with both 0 and 7 mapping to Sunday.

* The conversion from weekday to unsigned has been removed.

* To convert a weekday to unsigned replace:

      auto u = unsigned{wd};

  with:

      auto u = (wd - Sunday).count();

  This maps [Sunday, Saturday] to [0, 6], which is the
  C/POSIX mapping.  If you prefer the ISO mapping
  ([Monday, Sunday] -> [1, 7]), then do:

      auto u = (wd - Monday).count() + 1;
2018-06-02 22:56:10 -04:00
Tomasz Kamiński
328cecaa56 Fixed addition of multi-year duration to year_month.
* Added new overloads for operator+/- between year_month and duration
  that is convertible to years, so it is better candidate for operands
  that are convertible to both years and months. To preserve
  functionality, this operator is conditionally noexcept.

* Reworked year_month_day, year_month_day_last, year_month_weekday,
  and year_month_weekday_last.

* Added tests for this new functionality.
2018-05-12 18:21:24 -04:00
Howard Hinnant
1d9e49ea21 to_stream sets failbit if unable to format
*  If a formatting flag requests data that is not available in
   the Streamable object, or if the Streamable object answers !ok(),
   failbit is set.
2018-04-06 11:19:44 -04:00
Harry Mallon
c311db2f1a Clean up tz_test README 2018-03-18 18:14:40 -04:00
Howard Hinnant
43d8a4eab0 Range check minutes under parse 2018-03-02 09:03:41 -05:00
Howard Hinnant
c513a20691 Fix off-by-one bug in iso_week::year_lastweek_weekday
* The conversion from year_lastweek_weekday to sys_days
  and local_days had an off by one error.
* Added test for this case.
2017-11-30 10:28:14 -05:00
Tomasz Kamiński
543315b700 Reversed order of arguments to clock_time_conversion.
Now the order of argument matches the clock_cast function.
The test only is_clock_castable trait still matches is_convertible
order of arguments.
2017-11-26 13:50:21 -05:00
Tomasz Kamiński
dd91be668e Added deprecated functions test for real 2017-11-24 23:42:18 +01:00
Tomasz Kamiński
b13c859ff1 Restored deprecated to_clock_time function.
Fixed the to_utc_time(const gps_time<Duration>& t) function
to correctly use clock_cast<utc_time>.

Added test to deprecated functions.
2017-11-24 23:37:32 +01:00
Tomasz Kamiński
9910f5fcc3 Moved clock_cast test to separate dir.
Fixed naqme of the to_sys_return_reference test, so it
is invoked.
2017-11-24 22:30:54 +01:00
Tomasz Kamiński
58a4a9518a Mismatch in return type of converting function is now hard error.
Change the implementation, in the way that mismatch in return
type of the from/to_sys/utc functions (not returning time_point,
or returning time_point with inappropriate clock) leads to
hard error.

Added appropariate fail test for to_sys function, including:
* returning an int
* returning time_point of wrong clock
* reutrning reference to time_point
2017-11-24 22:23:50 +01:00
Tomasz Kamiński
5a9b44a37a Implemented test for casting non-wall clocks and detecting that clocks cannot be casted.
Added test that detects if clock_cast<Dest>(Source) properly
SFINAEs if clock's are not castable, this includes test for
steady_clock that is not castable to any wall-clock.

Secondly added steady_based_clock based on steady_clock
(as name indicates), that clock_cast may be extended to clock
non-related to wall-time (sys/utc) using conversion traits.

Final example is pair of ambiguous clocks (amb1/amb2_clock) that can convert
to each other either using sys_clock or utc_clock.
Then the conversion from amb2 to amb1 is disambiguated
via trait specialization.
2017-11-24 18:08:00 +01:00
Tomasz Kamiński
a9d2907fa1 Implemented test for custom clocks derived from sys_clock.
Created mil_clock and s2s_clock, that are both using to_sys/from_sys
function and are fully interoperable with existing clocks (including
ones based on utc).

Implemented an trait is used to provide direct conversion
from s2s_clock to mil_clock without converting to sys_clock
(conversion counter is used for this purpose).
2017-11-24 18:07:33 +01:00
Tomasz Kamiński
bf5a4f3cd5 Implemented test for existing clocks.
Implemented test for conversions between existing clocks
(sys_clock, utc_clock, tai_clock, gps_clock) showing that
they can be used instead of to_clock_time functions.
2017-11-24 18:06:55 +01:00
Howard Hinnant
5563d31b2e Update validation.cpp for new directory structure 2017-10-24 12:06:50 -04:00
Howard Hinnant
fc917fe303 Port testit to new directory structure 2017-09-25 19:28:04 -04:00
Howard Hinnant
481771ef5e Add support down to femtosecond precision
* Requires platform specific use of 128bit integral representation
  (e.g. std::chrono::duration<__int128_t, std::femto>).
2017-09-09 10:30:39 -04:00
Howard Hinnant
aad6010831 Add test for custom time zone support 2017-08-31 10:44:07 -04:00
Howard Hinnant
9c181a1440 Update tests for default constructible:
* weekday_indexed
* year_month_weekday
2017-08-05 16:31:18 -04:00