This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch to fix irix5 & irix6 libstdc++-v3 scan_not() implementations


The current implementation of scan_is() vs scan_not() for the
libstdc++-v3 irix ports don't agree on what the base of the ctype
lookup table is.  If you look at scan_is() it starts at `_M_table,'
while scan_not() starts at `_M_table + 1'.  One of them has to be
wrong. :-) And in fact my irix box currently fails the testcase I
wrote in the patch below.

This problem originated back in Nov 2000 when all irix ports had one
config directory.  This patch:
http://gcc.gnu.org/ml/gcc-patches/2000-11/msg00065.html
changed all of the entries from `_M_table + 1' to `_M_table' but left
out scan_not() which from that day forward was broken I suppose.  When
the irix dir was split into irix5.2 vs irix6.5, this bug was
propagated to both ports.  However I think nothing in the testsuite
currently makes use of scan_not() in the right way to let you know
it's broken.

IMHO, the current code allows these kinds of typos to creep in because
it manually inlines the this->is() function.  I find the code more
readable and safer by calling this->is() and letting the compiler
inline it for me.

Tested via bootstrap + make "check-target-libstdc++-v3" on
mips-irix6.2 which tests the irix5.2 dir change.  I don't have access
to irix6.5 to test the other half, but it seems obvious on its face.
For good measure, I also ran the testcase on solaris2.7 to make sure I
understood the ctype stuff correctly.

(I'll queue it privately for 3.1.1.)
Okay to install on the trunk?

		Thanks,
		--Kaveh

PS: this is my first libstdc++-v3 testcase, and my c++ is a little
rusty, so please give the testcase an especially thorough review.  It
compiles and runs, but just to be sure it's conceptually and
stylistically correct... thanks.


2002-05-10  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* config/os/irix/irix5.2/bits/ctype_inline.h (scan_is, scan_not):
	Fix typo, use this->is() rather than manually (and perhaps
	incorrectly) inlining it.
	* config/os/irix/irix6.5/bits/ctype_inline.h (scan_is, scan_not):
	Likewise.
	* testsuite/22_locale/ctype_scan.cc: New file.

diff -rup orig/egcc-3.1-CVS20020510/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_inline.h egcc-3.1-CVS20020510/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_inline.h
--- orig/egcc-3.1-CVS20020510/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_inline.h	Sat May 11 01:13:42 2002
+++ egcc-3.1-CVS20020510/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_inline.h	Sat May 11 01:13:51 2002
@@ -52,8 +52,7 @@
   ctype<char>::
   scan_is(mask __m, const char* __low, const char* __high) const
   {
-    while (__low < __high 
-	   && !((_M_table)[static_cast<unsigned char>(*__low)] & __m))
+    while (__low < __high && ! this->is(__m, *__low))
       ++__low;
     return __low;
   }
@@ -62,8 +61,7 @@
   ctype<char>::
   scan_not(mask __m, const char* __low, const char* __high) const
   {
-    while (__low < __high 
-	   && ((_M_table + 1)[static_cast<unsigned char>(*__low)] & __m) != 0)
+    while (__low < __high && this->is(__m, *__low))
       ++__low;
     return __low;
   }
diff -rup orig/egcc-3.1-CVS20020510/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_inline.h egcc-3.1-CVS20020510/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_inline.h
--- orig/egcc-3.1-CVS20020510/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_inline.h	Wed Mar 13 08:06:49 2002
+++ egcc-3.1-CVS20020510/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_inline.h	Sat May 11 01:13:51 2002
@@ -52,8 +52,7 @@
   ctype<char>::
   scan_is(mask __m, const char* __low, const char* __high) const
   {
-    while (__low < __high 
-	   && !((_M_table)[static_cast<unsigned char>(*__low)] & __m))
+    while (__low < __high && ! this->is(__m, *__low))
       ++__low;
     return __low;
   }
@@ -62,8 +61,7 @@
   ctype<char>::
   scan_not(mask __m, const char* __low, const char* __high) const
   {
-    while (__low < __high 
-	   && ((_M_table + 1)[static_cast<unsigned char>(*__low)] & __m) != 0)
+    while (__low < __high && this->is(__m, *__low))
       ++__low;
     return __low;
   }
diff -rup orig/egcc-3.1-CVS20020510/libstdc++-v3/testsuite/22_locale/ctype_scan.cc egcc-3.1-CVS20020510/libstdc++-v3/testsuite/22_locale/ctype_scan.cc
--- orig/egcc-3.1-CVS20020510/libstdc++-v3/testsuite/22_locale/ctype_scan.cc	Sat May 11 01:14:20 2002
+++ egcc-3.1-CVS20020510/libstdc++-v3/testsuite/22_locale/ctype_scan.cc	Sat May 11 01:14:06 2002
@@ -0,0 +1,344 @@
+// 2002-05-10 ghazi
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-do run }
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+class gnu_ctype: public std::ctype<char> { };
+
+// These two macros take a ctype mask, a string and a pointer within
+// the string that the scan function should return, usually either the
+// first or last character if the string contains identical values as
+// below.
+#define VERIFY_SCAN_IS(MASK, STRING, EXPECTED) \
+  VERIFY(gctype.scan_is((MASK), (STRING), \
+			(STRING)+strlen(STRING)) == (EXPECTED))
+#define VERIFY_SCAN_NOT(MASK, STRING, EXPECTED) \
+  VERIFY(gctype.scan_not((MASK), (STRING), \
+			 (STRING)+strlen(STRING)) == (EXPECTED))
+
+// Sanity check scan_is() and scan_not().
+void test01()
+{
+  const char *const ca = "aaaaa";
+  const char *const cz = "zzzzz";
+  const char *const cA = "AAAAA";
+  const char *const cZ = "ZZZZZ";
+  const char *const c0 = "00000";
+  const char *const c9 = "99999";
+  const char *const cs = "     ";
+  const char *const xf = "fffff";
+  const char *const xF = "FFFFF";
+  const char *const p1 = "!!!!!";
+  const char *const p2 = "/////";
+  
+  gnu_ctype gctype;
+
+  // 'a'
+  VERIFY_SCAN_IS (std::ctype_base::alnum, ca, ca);
+  VERIFY_SCAN_IS (std::ctype_base::alpha, ca, ca);
+  VERIFY_SCAN_IS (std::ctype_base::cntrl, ca, ca+5);
+  VERIFY_SCAN_IS (std::ctype_base::digit, ca, ca+5);
+  VERIFY_SCAN_IS (std::ctype_base::graph, ca, ca);
+  VERIFY_SCAN_IS (std::ctype_base::lower, ca, ca);
+  VERIFY_SCAN_IS (std::ctype_base::print, ca, ca);
+  VERIFY_SCAN_IS (std::ctype_base::punct, ca, ca+5);
+  VERIFY_SCAN_IS (std::ctype_base::space, ca, ca+5);
+  VERIFY_SCAN_IS (std::ctype_base::upper, ca, ca+5);
+  VERIFY_SCAN_IS (std::ctype_base::xdigit, ca, ca);
+
+  VERIFY_SCAN_NOT (std::ctype_base::alnum, ca, ca+5);
+  VERIFY_SCAN_NOT (std::ctype_base::alpha, ca, ca+5);
+  VERIFY_SCAN_NOT (std::ctype_base::cntrl, ca, ca);
+  VERIFY_SCAN_NOT (std::ctype_base::digit, ca, ca);
+  VERIFY_SCAN_NOT (std::ctype_base::graph, ca, ca+5);
+  VERIFY_SCAN_NOT (std::ctype_base::lower, ca, ca+5);
+  VERIFY_SCAN_NOT (std::ctype_base::print, ca, ca+5);
+  VERIFY_SCAN_NOT (std::ctype_base::punct, ca, ca);
+  VERIFY_SCAN_NOT (std::ctype_base::space, ca, ca);
+  VERIFY_SCAN_NOT (std::ctype_base::upper, ca, ca);
+  VERIFY_SCAN_NOT (std::ctype_base::xdigit, ca, ca+5);
+
+  // 'z'
+  VERIFY_SCAN_IS (std::ctype_base::alnum, cz, cz);
+  VERIFY_SCAN_IS (std::ctype_base::alpha, cz, cz);
+  VERIFY_SCAN_IS (std::ctype_base::cntrl, cz, cz+5);
+  VERIFY_SCAN_IS (std::ctype_base::digit, cz, cz+5);
+  VERIFY_SCAN_IS (std::ctype_base::graph, cz, cz);
+  VERIFY_SCAN_IS (std::ctype_base::lower, cz, cz);
+  VERIFY_SCAN_IS (std::ctype_base::print, cz, cz);
+  VERIFY_SCAN_IS (std::ctype_base::punct, cz, cz+5);
+  VERIFY_SCAN_IS (std::ctype_base::space, cz, cz+5);
+  VERIFY_SCAN_IS (std::ctype_base::upper, cz, cz+5);
+  VERIFY_SCAN_IS (std::ctype_base::xdigit, cz, cz+5);
+  
+  VERIFY_SCAN_NOT (std::ctype_base::alnum, cz, cz+5);
+  VERIFY_SCAN_NOT (std::ctype_base::alpha, cz, cz+5);
+  VERIFY_SCAN_NOT (std::ctype_base::cntrl, cz, cz);
+  VERIFY_SCAN_NOT (std::ctype_base::digit, cz, cz);
+  VERIFY_SCAN_NOT (std::ctype_base::graph, cz, cz+5);
+  VERIFY_SCAN_NOT (std::ctype_base::lower, cz, cz+5);
+  VERIFY_SCAN_NOT (std::ctype_base::print, cz, cz+5);
+  VERIFY_SCAN_NOT (std::ctype_base::punct, cz, cz);
+  VERIFY_SCAN_NOT (std::ctype_base::space, cz, cz);
+  VERIFY_SCAN_NOT (std::ctype_base::upper, cz, cz);
+  VERIFY_SCAN_NOT (std::ctype_base::xdigit, cz, cz);
+  
+  // 'A'
+  VERIFY_SCAN_IS (std::ctype_base::alnum, cA, cA);
+  VERIFY_SCAN_IS (std::ctype_base::alpha, cA, cA);
+  VERIFY_SCAN_IS (std::ctype_base::cntrl, cA, cA+5);
+  VERIFY_SCAN_IS (std::ctype_base::digit, cA, cA+5);
+  VERIFY_SCAN_IS (std::ctype_base::graph, cA, cA);
+  VERIFY_SCAN_IS (std::ctype_base::lower, cA, cA+5);
+  VERIFY_SCAN_IS (std::ctype_base::print, cA, cA);
+  VERIFY_SCAN_IS (std::ctype_base::punct, cA, cA+5);
+  VERIFY_SCAN_IS (std::ctype_base::space, cA, cA+5);
+  VERIFY_SCAN_IS (std::ctype_base::upper, cA, cA);
+  VERIFY_SCAN_IS (std::ctype_base::xdigit, cA, cA);
+  
+  VERIFY_SCAN_NOT (std::ctype_base::alnum, cA, cA+5);
+  VERIFY_SCAN_NOT (std::ctype_base::alpha, cA, cA+5);
+  VERIFY_SCAN_NOT (std::ctype_base::cntrl, cA, cA);
+  VERIFY_SCAN_NOT (std::ctype_base::digit, cA, cA);
+  VERIFY_SCAN_NOT (std::ctype_base::graph, cA, cA+5);
+  VERIFY_SCAN_NOT (std::ctype_base::lower, cA, cA);
+  VERIFY_SCAN_NOT (std::ctype_base::print, cA, cA+5);
+  VERIFY_SCAN_NOT (std::ctype_base::punct, cA, cA);
+  VERIFY_SCAN_NOT (std::ctype_base::space, cA, cA);
+  VERIFY_SCAN_NOT (std::ctype_base::upper, cA, cA+5);
+  VERIFY_SCAN_NOT (std::ctype_base::xdigit, cA, cA+5);
+  
+  // 'Z'
+  VERIFY_SCAN_IS (std::ctype_base::alnum, cZ, cZ);
+  VERIFY_SCAN_IS (std::ctype_base::alpha, cZ, cZ);
+  VERIFY_SCAN_IS (std::ctype_base::cntrl, cZ, cZ+5);
+  VERIFY_SCAN_IS (std::ctype_base::digit, cZ, cZ+5);
+  VERIFY_SCAN_IS (std::ctype_base::graph, cZ, cZ);
+  VERIFY_SCAN_IS (std::ctype_base::lower, cZ, cZ+5);
+  VERIFY_SCAN_IS (std::ctype_base::print, cZ, cZ);
+  VERIFY_SCAN_IS (std::ctype_base::punct, cZ, cZ+5);
+  VERIFY_SCAN_IS (std::ctype_base::space, cZ, cZ+5);
+  VERIFY_SCAN_IS (std::ctype_base::upper, cZ, cZ);
+  VERIFY_SCAN_IS (std::ctype_base::xdigit, cZ, cZ+5);
+  
+  VERIFY_SCAN_NOT (std::ctype_base::alnum, cZ, cZ+5);
+  VERIFY_SCAN_NOT (std::ctype_base::alpha, cZ, cZ+5);
+  VERIFY_SCAN_NOT (std::ctype_base::cntrl, cZ, cZ);
+  VERIFY_SCAN_NOT (std::ctype_base::digit, cZ, cZ);
+  VERIFY_SCAN_NOT (std::ctype_base::graph, cZ, cZ+5);
+  VERIFY_SCAN_NOT (std::ctype_base::lower, cZ, cZ);
+  VERIFY_SCAN_NOT (std::ctype_base::print, cZ, cZ+5);
+  VERIFY_SCAN_NOT (std::ctype_base::punct, cZ, cZ);
+  VERIFY_SCAN_NOT (std::ctype_base::space, cZ, cZ);
+  VERIFY_SCAN_NOT (std::ctype_base::upper, cZ, cZ+5);
+  VERIFY_SCAN_NOT (std::ctype_base::xdigit, cZ, cZ);
+  
+  // '0'
+  VERIFY_SCAN_IS (std::ctype_base::alnum, c0, c0);
+  VERIFY_SCAN_IS (std::ctype_base::alpha, c0, c0+5);
+  VERIFY_SCAN_IS (std::ctype_base::cntrl, c0, c0+5);
+  VERIFY_SCAN_IS (std::ctype_base::digit, c0, c0);
+  VERIFY_SCAN_IS (std::ctype_base::graph, c0, c0);
+  VERIFY_SCAN_IS (std::ctype_base::lower, c0, c0+5);
+  VERIFY_SCAN_IS (std::ctype_base::print, c0, c0);
+  VERIFY_SCAN_IS (std::ctype_base::punct, c0, c0+5);
+  VERIFY_SCAN_IS (std::ctype_base::space, c0, c0+5);
+  VERIFY_SCAN_IS (std::ctype_base::upper, c0, c0+5);
+  VERIFY_SCAN_IS (std::ctype_base::xdigit, c0, c0);
+  
+  VERIFY_SCAN_NOT (std::ctype_base::alnum, c0, c0+5);
+  VERIFY_SCAN_NOT (std::ctype_base::alpha, c0, c0);
+  VERIFY_SCAN_NOT (std::ctype_base::cntrl, c0, c0);
+  VERIFY_SCAN_NOT (std::ctype_base::digit, c0, c0+5);
+  VERIFY_SCAN_NOT (std::ctype_base::graph, c0, c0+5);
+  VERIFY_SCAN_NOT (std::ctype_base::lower, c0, c0);
+  VERIFY_SCAN_NOT (std::ctype_base::print, c0, c0+5);
+  VERIFY_SCAN_NOT (std::ctype_base::punct, c0, c0);
+  VERIFY_SCAN_NOT (std::ctype_base::space, c0, c0);
+  VERIFY_SCAN_NOT (std::ctype_base::upper, c0, c0);
+  VERIFY_SCAN_NOT (std::ctype_base::xdigit, c0, c0+5);
+  
+  // '9'
+  VERIFY_SCAN_IS (std::ctype_base::alnum, c9, c9);
+  VERIFY_SCAN_IS (std::ctype_base::alpha, c9, c9+5);
+  VERIFY_SCAN_IS (std::ctype_base::cntrl, c9, c9+5);
+  VERIFY_SCAN_IS (std::ctype_base::digit, c9, c9);
+  VERIFY_SCAN_IS (std::ctype_base::graph, c9, c9);
+  VERIFY_SCAN_IS (std::ctype_base::lower, c9, c9+5);
+  VERIFY_SCAN_IS (std::ctype_base::print, c9, c9);
+  VERIFY_SCAN_IS (std::ctype_base::punct, c9, c9+5);
+  VERIFY_SCAN_IS (std::ctype_base::space, c9, c9+5);
+  VERIFY_SCAN_IS (std::ctype_base::upper, c9, c9+5);
+  VERIFY_SCAN_IS (std::ctype_base::xdigit, c9, c9);
+  
+  VERIFY_SCAN_NOT (std::ctype_base::alnum, c9, c9+5);
+  VERIFY_SCAN_NOT (std::ctype_base::alpha, c9, c9);
+  VERIFY_SCAN_NOT (std::ctype_base::cntrl, c9, c9);
+  VERIFY_SCAN_NOT (std::ctype_base::digit, c9, c9+5);
+  VERIFY_SCAN_NOT (std::ctype_base::graph, c9, c9+5);
+  VERIFY_SCAN_NOT (std::ctype_base::lower, c9, c9);
+  VERIFY_SCAN_NOT (std::ctype_base::print, c9, c9+5);
+  VERIFY_SCAN_NOT (std::ctype_base::punct, c9, c9);
+  VERIFY_SCAN_NOT (std::ctype_base::space, c9, c9);
+  VERIFY_SCAN_NOT (std::ctype_base::upper, c9, c9);
+  VERIFY_SCAN_NOT (std::ctype_base::xdigit, c9, c9+5);
+  
+  // ' '
+  VERIFY_SCAN_IS (std::ctype_base::alnum, cs, cs+5);
+  VERIFY_SCAN_IS (std::ctype_base::alpha, cs, cs+5);
+  VERIFY_SCAN_IS (std::ctype_base::cntrl, cs, cs+5);
+  VERIFY_SCAN_IS (std::ctype_base::digit, cs, cs+5);
+  VERIFY_SCAN_IS (std::ctype_base::graph, cs, cs+5);
+  VERIFY_SCAN_IS (std::ctype_base::lower, cs, cs+5);
+  VERIFY_SCAN_IS (std::ctype_base::print, cs, cs);
+  VERIFY_SCAN_IS (std::ctype_base::punct, cs, cs+5);
+  VERIFY_SCAN_IS (std::ctype_base::space, cs, cs);
+  VERIFY_SCAN_IS (std::ctype_base::upper, cs, cs+5);
+  VERIFY_SCAN_IS (std::ctype_base::xdigit, cs, cs+5);
+  
+  VERIFY_SCAN_NOT (std::ctype_base::alnum, cs, cs);
+  VERIFY_SCAN_NOT (std::ctype_base::alpha, cs, cs);
+  VERIFY_SCAN_NOT (std::ctype_base::cntrl, cs, cs);
+  VERIFY_SCAN_NOT (std::ctype_base::digit, cs, cs);
+  VERIFY_SCAN_NOT (std::ctype_base::graph, cs, cs);
+  VERIFY_SCAN_NOT (std::ctype_base::lower, cs, cs);
+  VERIFY_SCAN_NOT (std::ctype_base::print, cs, cs+5);
+  VERIFY_SCAN_NOT (std::ctype_base::punct, cs, cs);
+  VERIFY_SCAN_NOT (std::ctype_base::space, cs, cs+5);
+  VERIFY_SCAN_NOT (std::ctype_base::upper, cs, cs);
+  VERIFY_SCAN_NOT (std::ctype_base::xdigit, cs, cs);
+  
+  // 'f'
+  VERIFY_SCAN_IS (std::ctype_base::alnum, xf, xf);
+  VERIFY_SCAN_IS (std::ctype_base::alpha, xf, xf);
+  VERIFY_SCAN_IS (std::ctype_base::cntrl, xf, xf+5);
+  VERIFY_SCAN_IS (std::ctype_base::digit, xf, xf+5);
+  VERIFY_SCAN_IS (std::ctype_base::graph, xf, xf);
+  VERIFY_SCAN_IS (std::ctype_base::lower, xf, xf);
+  VERIFY_SCAN_IS (std::ctype_base::print, xf, xf);
+  VERIFY_SCAN_IS (std::ctype_base::punct, xf, xf+5);
+  VERIFY_SCAN_IS (std::ctype_base::space, xf, xf+5);
+  VERIFY_SCAN_IS (std::ctype_base::upper, xf, xf+5);
+  VERIFY_SCAN_IS (std::ctype_base::xdigit, xf, xf);
+  
+  VERIFY_SCAN_NOT (std::ctype_base::alnum, xf, xf+5);
+  VERIFY_SCAN_NOT (std::ctype_base::alpha, xf, xf+5);
+  VERIFY_SCAN_NOT (std::ctype_base::cntrl, xf, xf);
+  VERIFY_SCAN_NOT (std::ctype_base::digit, xf, xf);
+  VERIFY_SCAN_NOT (std::ctype_base::graph, xf, xf+5);
+  VERIFY_SCAN_NOT (std::ctype_base::lower, xf, xf+5);
+  VERIFY_SCAN_NOT (std::ctype_base::print, xf, xf+5);
+  VERIFY_SCAN_NOT (std::ctype_base::punct, xf, xf);
+  VERIFY_SCAN_NOT (std::ctype_base::space, xf, xf);
+  VERIFY_SCAN_NOT (std::ctype_base::upper, xf, xf);
+  VERIFY_SCAN_NOT (std::ctype_base::xdigit, xf, xf+5);
+  
+  // 'F'
+  VERIFY_SCAN_IS (std::ctype_base::alnum, xF, xF);
+  VERIFY_SCAN_IS (std::ctype_base::alpha, xF, xF);
+  VERIFY_SCAN_IS (std::ctype_base::cntrl, xF, xF+5);
+  VERIFY_SCAN_IS (std::ctype_base::digit, xF, xF+5);
+  VERIFY_SCAN_IS (std::ctype_base::graph, xF, xF);
+  VERIFY_SCAN_IS (std::ctype_base::lower, xF, xF+5);
+  VERIFY_SCAN_IS (std::ctype_base::print, xF, xF);
+  VERIFY_SCAN_IS (std::ctype_base::punct, xF, xF+5);
+  VERIFY_SCAN_IS (std::ctype_base::space, xF, xF+5);
+  VERIFY_SCAN_IS (std::ctype_base::upper, xF, xF);
+  VERIFY_SCAN_IS (std::ctype_base::xdigit, xF, xF);
+  
+  VERIFY_SCAN_NOT (std::ctype_base::alnum, xF, xF+5);
+  VERIFY_SCAN_NOT (std::ctype_base::alpha, xF, xF+5);
+  VERIFY_SCAN_NOT (std::ctype_base::cntrl, xF, xF);
+  VERIFY_SCAN_NOT (std::ctype_base::digit, xF, xF);
+  VERIFY_SCAN_NOT (std::ctype_base::graph, xF, xF+5);
+  VERIFY_SCAN_NOT (std::ctype_base::lower, xF, xF);
+  VERIFY_SCAN_NOT (std::ctype_base::print, xF, xF+5);
+  VERIFY_SCAN_NOT (std::ctype_base::punct, xF, xF);
+  VERIFY_SCAN_NOT (std::ctype_base::space, xF, xF);
+  VERIFY_SCAN_NOT (std::ctype_base::upper, xF, xF+5);
+  VERIFY_SCAN_NOT (std::ctype_base::xdigit, xF, xF+5);
+  
+  // '!'
+  VERIFY_SCAN_IS (std::ctype_base::alnum, p1, p1+5);
+  VERIFY_SCAN_IS (std::ctype_base::alpha, p1, p1+5);
+  VERIFY_SCAN_IS (std::ctype_base::cntrl, p1, p1+5);
+  VERIFY_SCAN_IS (std::ctype_base::digit, p1, p1+5);
+  VERIFY_SCAN_IS (std::ctype_base::graph, p1, p1);
+  VERIFY_SCAN_IS (std::ctype_base::lower, p1, p1+5);
+  VERIFY_SCAN_IS (std::ctype_base::print, p1, p1);
+  VERIFY_SCAN_IS (std::ctype_base::punct, p1, p1);
+  VERIFY_SCAN_IS (std::ctype_base::space, p1, p1+5);
+  VERIFY_SCAN_IS (std::ctype_base::upper, p1, p1+5);
+  VERIFY_SCAN_IS (std::ctype_base::xdigit, p1, p1+5);
+  
+  VERIFY_SCAN_NOT (std::ctype_base::alnum, p1, p1);
+  VERIFY_SCAN_NOT (std::ctype_base::alpha, p1, p1);
+  VERIFY_SCAN_NOT (std::ctype_base::cntrl, p1, p1);
+  VERIFY_SCAN_NOT (std::ctype_base::digit, p1, p1);
+  VERIFY_SCAN_NOT (std::ctype_base::lower, p1, p1);
+  VERIFY_SCAN_NOT (std::ctype_base::print, p1, p1+5);
+  VERIFY_SCAN_NOT (std::ctype_base::punct, p1, p1+5);
+  VERIFY_SCAN_NOT (std::ctype_base::space, p1, p1);
+  VERIFY_SCAN_NOT (std::ctype_base::upper, p1, p1);
+  VERIFY_SCAN_NOT (std::ctype_base::xdigit, p1, p1);
+  
+  // '/'
+  VERIFY_SCAN_IS (std::ctype_base::alnum, p2, p2+5);
+  VERIFY_SCAN_IS (std::ctype_base::alpha, p2, p2+5);
+  VERIFY_SCAN_IS (std::ctype_base::cntrl, p2, p2+5);
+  VERIFY_SCAN_IS (std::ctype_base::digit, p2, p2+5);
+  VERIFY_SCAN_IS (std::ctype_base::graph, p2, p2);
+  VERIFY_SCAN_IS (std::ctype_base::lower, p2, p2+5);
+  VERIFY_SCAN_IS (std::ctype_base::print, p2, p2);
+  VERIFY_SCAN_IS (std::ctype_base::punct, p2, p2);
+  VERIFY_SCAN_IS (std::ctype_base::space, p2, p2+5);
+  VERIFY_SCAN_IS (std::ctype_base::upper, p2, p2+5);
+  VERIFY_SCAN_IS (std::ctype_base::xdigit, p2, p2+5);
+
+  VERIFY_SCAN_NOT (std::ctype_base::alnum, p2, p2);
+  VERIFY_SCAN_NOT (std::ctype_base::alpha, p2, p2);
+  VERIFY_SCAN_NOT (std::ctype_base::cntrl, p2, p2);
+  VERIFY_SCAN_NOT (std::ctype_base::digit, p2, p2);
+  VERIFY_SCAN_NOT (std::ctype_base::graph, p2, p2+5);
+  VERIFY_SCAN_NOT (std::ctype_base::lower, p2, p2);
+  VERIFY_SCAN_NOT (std::ctype_base::print, p2, p2+5);
+  VERIFY_SCAN_NOT (std::ctype_base::punct, p2, p2+5);
+  VERIFY_SCAN_NOT (std::ctype_base::space, p2, p2);
+  VERIFY_SCAN_NOT (std::ctype_base::upper, p2, p2);
+  VERIFY_SCAN_NOT (std::ctype_base::xdigit, p2, p2);
+}
+
+int main() 
+{
+  test01();
+  return 0;
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]