aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/22_locale/codecvt_members_unicode_wchar_t.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/22_locale/codecvt_members_unicode_wchar_t.cc')
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt_members_unicode_wchar_t.cc69
1 files changed, 64 insertions, 5 deletions
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt_members_unicode_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/codecvt_members_unicode_wchar_t.cc
index 87a2f05bf6c..c944865b08f 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt_members_unicode_wchar_t.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt_members_unicode_wchar_t.cc
@@ -1,6 +1,6 @@
// 2000-08-23 Benjamin Kosnik <bkoz@cygnus.com>
-// Copyright (C) 2000, 2001 Free Software Foundation
+// Copyright (C) 2000, 2001, 2002 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -23,21 +23,80 @@
#include <locale>
#include <testsuite_hooks.h>
-using namespace std;
-
#ifdef _GLIBCPP_USE___ENC_TRAITS
#ifdef _GLIBCPP_USE_WCHAR_T
+// Need some char_traits specializations for this to work.
+typedef unsigned short unicode_t;
+
+namespace std
+{
+ template<>
+ struct char_traits<unicode_t>
+ {
+ typedef unicode_t char_type;
+ // Unsigned as wint_t is unsigned.
+ typedef unsigned long int_type;
+ typedef streampos pos_type;
+ typedef streamoff off_type;
+ typedef mbstate_t state_type;
+
+ static void
+ assign(char_type& __c1, const char_type& __c2);
+
+ static bool
+ eq(const char_type& __c1, const char_type& __c2);
+
+ static bool
+ lt(const char_type& __c1, const char_type& __c2);
+
+ static int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n)
+ { return memcmp(__s1, __s2, __n); }
+
+ static size_t
+ length(const char_type* __s);
+
+ static const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a);
+
+ static char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n);
+
+ static char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n)
+ { return static_cast<char_type*>(memcpy(__s1, __s2, __n)); }
+
+ static char_type*
+ assign(char_type* __s, size_t __n, char_type __a);
+
+ static char_type
+ to_char_type(const int_type& __c);
+
+ static int_type
+ to_int_type(const char_type& __c);
+
+ static bool
+ eq_int_type(const int_type& __c1, const int_type& __c2);
+
+ static int_type
+ eof();
+
+ static int_type
+ not_eof(const int_type& __c);
+ };
+}
+
void
-initialize_state(__enc_traits& state)
+initialize_state(std::__enc_traits& state)
{ state._M_init(); }
// Partial specialization using __enc_traits.
// codecvt<unicode_t, wchar_t, __enc_traits>
void test01()
{
+ using namespace std;
typedef codecvt_base::result result;
- typedef unsigned short unicode_t;
typedef unicode_t int_type;
typedef wchar_t ext_type;
typedef __enc_traits enc_type;