Debian Codegraph @

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

raw
1 // { dg-do run { target c++20 } }
2 // { dg-require-namedlocale "fr_FR.ISO8859-15" }
3 // { dg-timeout-factor 2 }
4
5 #include <chrono>
6 #include <sstream>
7 #include <testsuite_hooks.h>
8
9 void
10 test_ostream()
11 {
12 using std::ostringstream;
13 using namespace std::chrono;
14
15 ostringstream ss;
16 ss << 2023y/January/Saturday[2];
17 VERIFY( ss.str() == "2023/Jan/Sat[2]" );
18 ss.clear();
19 ss.str("");
20 ss << 2023y/month(13)/Monday[1];
21 VERIFY( ss.str() == "2023/13 is not a valid month/Mon[1]" );
22 ss.clear();
23 ss.str("");
24 ss << 2023y/December/weekday(9)[5];
25 VERIFY( ss.str() == "2023/Dec/9 is not a valid weekday[5]" );
26 ss.clear();
27 ss.str("");
28 ss << 2023y/December/Monday[6];
29 VERIFY( ss.str() == "2023/Dec/Mon[6 is not a valid index]" );
30
31 ss.str("");
32 ss.imbue(std::locale(ISO_8859(15,fr_FR)));
33 ss << 2023y/July/Thursday[2];
34 VERIFY( ss.str() == "2023/juil./jeu.[2]" );
35 }
36
37 int main()
38 {
39 test_ostream();
40 // TODO: test_format();
41 // TODO: test_parse();
42 }