Debian Codegraph @

libstdc++-v3/testsuite/22_locale/locale/encoding.cc

raw symbols SCIP
1 // { dg-options "-lstdc++exp" }
2 // { dg-do run { target c++26 } }
3 // { dg-require-namedlocale "en_US.ISO8859-1" }
4 // { dg-require-namedlocale "fr_FR.ISO8859-15" }
5
6 #include <locale>
7 #include <testsuite_hooks.h>
8
9 void
10 test_encoding()
11 {
12 const std::locale c = std::locale::classic();
13 std::text_encoding c_enc = c.encoding();
14 VERIFY( c_enc == std::text_encoding::ASCII );
15
16 const std::locale fr = std::locale(ISO_8859(15, fr_FR));
17 std::text_encoding fr_enc = fr.encoding();
18 VERIFY( fr_enc == std::text_encoding::ISO885915 );
19
20 const std::locale en = std::locale(ISO_8859(1, en_US));
21 std::text_encoding en_enc = en.encoding();
22 VERIFY( en_enc == std::text_encoding::ISOLatin1 );
23
24 #if __cpp_exceptions
25 try {
26 const std::locale c_utf8 = std::locale("C.UTF-8");
27 VERIFY( c_utf8.encoding() == std::text_encoding::UTF8 );
28 } catch (...) {
29 }
30 #endif
31 }
32
33 int main()
34 {
35 test_encoding();
36 }