1 // { dg-require-namedlocale "se_NO.UTF-8" }
3 // 2003-09-08 Petur Runolfsson <peturr02@ru.is>
5 // Copyright (C) 2003-2013 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 bool test __attribute__((unused)) = true;
36 const char name[] = "tmp_seekoff-2.tst";
38 locale loc = locale("se_NO.UTF-8");
40 const size_t size = 10;
46 fb.open(name, ios_base::in | ios_base::out | ios_base::trunc);
48 n = fb.sputn(L"\xa0st", 3);
51 fb.pubseekoff(0, ios_base::beg);
54 VERIFY( !wmemcmp(buf, L"\xa0s", 2) );
56 fb.pubseekoff(0, ios_base::cur);
57 n = fb.sputn(L"\xb2R", 2);
60 fb.pubseekoff(0, ios_base::beg);
61 n = fb.sgetn(buf, size);
63 VERIFY( !wmemcmp(buf, L"\xa0s\xb2R", 4) );
65 fb.pubseekoff(0, ios_base::beg);
66 n = fb.sputn(L"\x90m\x92n\x94", 5);
69 fb.pubseekoff(0, ios_base::beg);
72 VERIFY( !wmemcmp(buf, L"\x90m", 2) );
74 fb.pubseekoff(0, ios_base::end);
75 n = fb.sputn(L"I\xbfJ", 3);
78 fb.pubseekoff(0, ios_base::beg);
79 n = fb.sgetn(buf, size);
81 VERIFY( !wmemcmp(buf, L"\x90m\x92n\x94I\xbfJ", 8) );