Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Side by Side Diff: gcc/libstdc++-v3/testsuite/27_io/basic_stringbuf/in_avail/char/1.cc

Issue 3050029: [gcc] GCC 4.5.0=>4.5.1 (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/nacl-toolchain.git
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // 981208 bkoz test functionality of basic_stringbuf for char_type == char
2
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009
4 // Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
10 // any later version.
11
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
20
21 #include <sstream>
22 #include <testsuite_hooks.h>
23
24 std::string str_01("mykonos. . . or what?");
25 std::string str_02("paris, or sainte-maxime?");
26 std::string str_03;
27 std::stringbuf strb_01(str_01);
28 std::stringbuf strb_02(str_02, std::ios_base::in);
29 std::stringbuf strb_03(str_03, std::ios_base::out);
30
31 // test overloaded virtual functions
32 void test04()
33 {
34 bool test __attribute__((unused)) = true;
35 std::streamoff strmof_1(-1), strmof_2;
36
37 // GET
38 // int in_avail()
39 strmof_1 = strb_01.in_avail();
40 strmof_2 = strb_02.in_avail();
41 VERIFY( strmof_1 != strmof_2 );
42 VERIFY( strmof_1 == static_cast<std::streamoff>(str_01.length()) );
43 VERIFY( strmof_2 == static_cast<std::streamoff>(str_02.length()) );
44 strmof_1 = strb_03.in_avail();
45 // zero cuz write-only, or eof() to match basic_filebuf
46 VERIFY( strmof_1 == -1 );
47 }
48
49 int main()
50 {
51 test04();
52 return 0;
53 }
54
55
56
57 // more candy!!!
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698