2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libstdc++-v3 / testsuite / 27_io / basic_filebuf / seekoff / 10132-2.cc
blob14f0870517f4228077883e8fa74206fa3c8e079f
1 // 2003-04-24 bkoz
3 // Copyright (C) 2003 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 2, 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 COPYING. If not, write to the Free
18 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // USA.
21 // 27.8.1.1 - Template class basic_filebuf
22 // NB: This file is for testing basic_filebuf with NO OTHER INCLUDES.
24 #include <fstream>
25 #include <testsuite_hooks.h>
27 // libstdc++/10132, add on
28 class gnu_char_type
30 unsigned long character;
31 public:
32 // operator ==
33 bool
34 operator==(const gnu_char_type& __lhs)
35 { return character == __lhs.character; }
37 // operator <
38 bool
39 operator<(const gnu_char_type& __lhs)
40 { return character < __lhs.character; }
42 // default ctor
43 gnu_char_type() { }
45 // to_char_type
46 gnu_char_type(const unsigned long& __l) : character(__l) { }
48 // to_int_type
49 operator unsigned long() const { return character; }
52 // char_traits specialization
53 struct gnu_char_traits
55 typedef gnu_char_type char_type;
56 typedef long int_type;
57 typedef std::streamoff off_type;
58 typedef long state_type;
59 typedef std::fpos<state_type> pos_type;
61 static void
62 assign(char_type& __c1, const char_type& __c2) { }
64 static bool
65 eq(const char_type& __c1, const char_type& __c2) { return true; }
67 static bool
68 lt(const char_type& __c1, const char_type& __c2) { return true; }
70 static int
71 compare(const char_type* __s1, const char_type* __s2, size_t __n)
72 { return 0; }
74 static size_t
75 length(const char_type* __s) { return 0; }
77 static const char_type*
78 find(const char_type* __s, size_t __n, const char_type& __a)
79 { return __s; }
81 static char_type*
82 move(char_type* __s1, const char_type* __s2, size_t __n)
83 { return __s1; }
85 static char_type*
86 copy(char_type* __s1, const char_type* __s2, size_t __n)
87 { return __s1; }
89 static char_type*
90 assign(char_type* __s, size_t __n, char_type __a)
91 { return __s; }
93 static char_type
94 to_char_type(const int_type& __c)
95 { return char_type(); }
97 static int_type
98 to_int_type(const char_type& __c)
99 { return int_type(); }
101 static bool
102 eq_int_type(const int_type& __c1, const int_type& __c2)
103 { return true; }
105 static int_type
106 eof()
107 { return int_type(); }
109 static int_type
110 not_eof(const int_type& __c)
111 { return int_type(); }
114 void test07()
116 bool test __attribute__((unused)) = true;
117 typedef std::basic_filebuf<gnu_char_type, gnu_char_traits> gnu_filebuf;
121 // Need codecvt facet for width argument in seekoff.
122 gnu_filebuf obj;
123 obj.pubseekoff(2, std::ios_base::beg);
125 catch(std::exception& obj)
127 test = false;
128 VERIFY( test );
132 int main()
134 test07();
135 return 0;
140 // more surf!!!