Debian Codegraph @

libstdc++-v3/testsuite/std/time/leap_seconds/io.cc

raw
1 // { dg-do run { target c++20 } }
2 // { dg-require-effective-target tzdb }
3 // { dg-require-effective-target cxx11_abi }
4
5 #include <chrono>
6 #include <sstream>
7 #include <format>
8 #include <testsuite_hooks.h>
9
10 void
11 test_output()
12 {
13 using namespace std::chrono;
14
15 std::ostringstream out;
16 out << '\n';
17
18 for (auto& l : get_tzdb().leap_seconds)
19 if (l <= sys_days{2018y/March/17d})
20 out << l.date() << ": " << l.value() << '\n';
21
22 VERIFY( out.str() == R"(
23 1972-07-01 00:00:00: 1s
24 1973-01-01 00:00:00: 1s
25 1974-01-01 00:00:00: 1s
26 1975-01-01 00:00:00: 1s
27 1976-01-01 00:00:00: 1s
28 1977-01-01 00:00:00: 1s
29 1978-01-01 00:00:00: 1s
30 1979-01-01 00:00:00: 1s
31 1980-01-01 00:00:00: 1s
32 1981-07-01 00:00:00: 1s
33 1982-07-01 00:00:00: 1s
34 1983-07-01 00:00:00: 1s
35 1985-07-01 00:00:00: 1s
36 1988-01-01 00:00:00: 1s
37 1990-01-01 00:00:00: 1s
38 1991-01-01 00:00:00: 1s
39 1992-07-01 00:00:00: 1s
40 1993-07-01 00:00:00: 1s
41 1994-07-01 00:00:00: 1s
42 1996-01-01 00:00:00: 1s
43 1997-07-01 00:00:00: 1s
44 1999-01-01 00:00:00: 1s
45 2006-01-01 00:00:00: 1s
46 2009-01-01 00:00:00: 1s
47 2012-07-01 00:00:00: 1s
48 2015-07-01 00:00:00: 1s
49 2017-01-01 00:00:00: 1s
50 )" );
51 }
52
53 int main()
54 {
55 test_output();
56 }