]>
Commit | Line | Data |
---|---|---|
23cac885 | 1 | // 1999-09-20 bkoz |
b2dad0e3 | 2 | |
7adcbafe | 3 | // Copyright (C) 1999-2022 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 | |
23cac885 | 20 | // 27.4.4.2 basic_ios member functions |
b2dad0e3 | 21 | |
23cac885 BK |
22 | // NB: Don't include any other headers in this file. |
23 | #include <ios> | |
fe413112 | 24 | #include <testsuite_hooks.h> |
b2dad0e3 BK |
25 | |
26 | void test01() | |
27 | { | |
23cac885 BK |
28 | typedef std::ios_base::fmtflags fmtflags; |
29 | typedef std::ios_base::iostate iostate; | |
30 | using std::ios_base; | |
31 | ||
23cac885 | 32 | // iostate exceptions() const |
11f10e6b | 33 | iostate iostate02; |
23cac885 | 34 | { |
8fc81078 | 35 | std::ios ios_01(0); |
23cac885 BK |
36 | VERIFY( ios_01.exceptions() == std::ios_base::goodbit ); |
37 | } | |
38 | ||
39 | // void exceptions(iostate except) | |
40 | { | |
8fc81078 | 41 | std::ios ios_01(0); |
23cac885 BK |
42 | try { |
43 | ios_01.exceptions(std::ios_base::eofbit); | |
cdd17d6e | 44 | } |
23cac885 BK |
45 | catch(...) { |
46 | VERIFY( false ); | |
13187a45 | 47 | } |
23cac885 BK |
48 | iostate02 = ios_01.exceptions(); |
49 | VERIFY( static_cast<bool>(iostate02 & std::ios_base::eofbit) ); | |
50 | } | |
51 | ||
52 | { | |
8fc81078 | 53 | std::ios ios_01(0); |
23cac885 BK |
54 | ios_01.clear(std::ios_base::eofbit); |
55 | try { | |
56 | ios_01.exceptions(std::ios_base::eofbit); | |
57 | VERIFY( false ); | |
cdd17d6e | 58 | } |
5f302518 | 59 | catch(std::ios_base::failure&) { |
23cac885 BK |
60 | iostate02 = ios_01.exceptions(); |
61 | VERIFY( static_cast<bool>(iostate02 & std::ios_base::eofbit) ); | |
62 | } | |
63 | catch(...) { | |
64 | VERIFY( false ); | |
65 | } | |
66 | } | |
afb6c265 PC |
67 | } |
68 | ||
cdd17d6e | 69 | int main() |
13187a45 | 70 | { |
b2dad0e3 BK |
71 | test01(); |
72 | return 0; | |
73 | } |