]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/wchar_t/2.cc
1 // { dg-require-namedlocale "se_NO.UTF-8" }
3 // 2003-09-08 Petur Runolfsson <peturr02@ru.is>
5 // Copyright (C) 2003-2024 Free Software Foundation, Inc.
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
22 // 27.8.1.4 Overridden virtual functions
27 #include <testsuite_hooks.h>
29 // Check that basic_filebuf::seekoff handles UTF-8 when open for input and
34 typedef wfilebuf::int_type int_type
;
35 const char name
[] = "tmp_seekoff-2.tst";
37 locale loc
= locale("se_NO.UTF-8");
39 const size_t size
= 10;
45 fb
.open(name
, ios_base::in
| ios_base::out
| ios_base::trunc
);
47 n
= fb
.sputn(L
"\xa0st", 3);
50 fb
.pubseekoff(0, ios_base::beg
);
53 VERIFY( !wmemcmp(buf
, L
"\xa0s", 2) );
55 fb
.pubseekoff(0, ios_base::cur
);
56 n
= fb
.sputn(L
"\xb2R", 2);
59 fb
.pubseekoff(0, ios_base::beg
);
60 n
= fb
.sgetn(buf
, size
);
62 VERIFY( !wmemcmp(buf
, L
"\xa0s\xb2R", 4) );
64 fb
.pubseekoff(0, ios_base::beg
);
65 n
= fb
.sputn(L
"\x90m\x92n\x94", 5);
68 fb
.pubseekoff(0, ios_base::beg
);
71 VERIFY( !wmemcmp(buf
, L
"\x90m", 2) );
73 fb
.pubseekoff(0, ios_base::end
);
74 n
= fb
.sputn(L
"I\xbfJ", 3);
77 fb
.pubseekoff(0, ios_base::beg
);
78 n
= fb
.sgetn(buf
, size
);
80 VERIFY( !wmemcmp(buf
, L
"\x90m\x92n\x94I\xbfJ", 8) );