]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/27_io/fpos/mbstate_t/1.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 27_io / fpos / mbstate_t / 1.cc
CommitLineData
b2dad0e3
BK
1// 1999-09-20 bkoz
2
cbe34bb5 3// Copyright (C) 1999-2017 Free Software Foundation, Inc.
b2dad0e3
BK
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
748086b7 8// Free Software Foundation; either version 3, or (at your option)
b2dad0e3
BK
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License along
748086b7
JJ
17// with this library; see the file COPYING3. If not see
18// <http://www.gnu.org/licenses/>.
b2dad0e3 19
b2dad0e3 20
23cac885 21// 27.4.3 template class fpos
b2dad0e3 22
23cac885
BK
23#include <cwchar> // for mbstate_t
24#include <ios>
1b716e90 25#include <cstring>
f13a69ec 26#include <testsuite_hooks.h>
b2dad0e3 27
bcc6a03a
BK
28void test01()
29{
23cac885 30 typedef std::mbstate_t state_type;
cc5112c9
BK
31 state_type state01 = state_type();
32 state_type state02 = state_type();
23cac885 33
cc5112c9
BK
34 std::streampos pos01(0);
35 std::streampos pos02(0);
23cac885 36
23cac885
BK
37 // 27.4.3.1 fpos members
38 // void state(state_type s);
39 // state_type state();
cc5112c9
BK
40
41 // XXX Need to have better sanity checking for the mbstate_t type,
42 // or whatever the insantiating type for class fpos happens to be
43 // for streampos, as things like equality operators and assignment
44 // operators, increment and deincrement operators need to be in
45 // place.
23cac885
BK
46 pos01.state(state02);
47 state01 = pos01.state();
fd0bf20c 48 VERIFY( std::memcmp(&state01, &state02, sizeof(state_type)) == 0 );
23cac885 49}
b2dad0e3 50
e6705174
BK
51int main()
52{
bcc6a03a 53 test01();
b2dad0e3
BK
54 return 0;
55}