Merged revisions 195034,195219,195245,195357,195374,195428,195599,195673,195809 via...
[official-gcc.git] / main / libstdc++-v3 / testsuite / 27_io / fpos / mbstate_t / 1.cc
blobfd3be281bd944a7fb91d9438713ff593d67933dd
1 // 1999-09-20 bkoz
3 // Copyright (C) 1999-2013 Free Software Foundation, Inc.
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
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
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.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
21 // 27.4.3 template class fpos
23 #include <cwchar> // for mbstate_t
24 #include <ios>
25 #include <cstring>
26 #include <testsuite_hooks.h>
28 void test01()
30 bool test __attribute__((unused)) = true;
32 typedef std::mbstate_t state_type;
33 state_type state01 = state_type();
34 state_type state02 = state_type();
36 std::streampos pos01(0);
37 std::streampos pos02(0);
39 // 27.4.3.1 fpos members
40 // void state(state_type s);
41 // state_type state();
43 // XXX Need to have better sanity checking for the mbstate_t type,
44 // or whatever the insantiating type for class fpos happens to be
45 // for streampos, as things like equality operators and assignment
46 // operators, increment and deincrement operators need to be in
47 // place.
48 pos01.state(state02);
49 state01 = pos01.state();
50 test = std::memcmp(&state01, &state02, sizeof(state_type)) == 0;
51 VERIFY( test );
54 int main()
56 test01();
57 return 0;