This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
parts/inc/misc: Shorten sub names
[perl5.git] / dist / Devel-PPPort / t / misc.t
index cb27932..1a80954 100644 (file)
@@ -30,15 +30,15 @@ BEGIN {
     require 'testutil.pl' if $@;
   }
 
-  if (48) {
+  if (128) {
     load();
-    plan(tests => 48);
+    plan(tests => 128);
   }
 }
 
 use Devel::PPPort;
 use strict;
-$^W = 1;
+BEGIN { $^W = 1; }
 
 package Devel::PPPort;
 use vars '@ISA';
@@ -155,3 +155,132 @@ if ("$]" < 5.005) {
         ok(Devel::PPPort::SvRXOK(bless $qr, "Surprise"));
 }
 
+ok(  Devel::PPPort::isBLANK(ord(" ")));
+ok(! Devel::PPPort::isBLANK(ord("\n")));
+
+ok(  Devel::PPPort::isBLANK_A(ord("\t")));
+ok(! Devel::PPPort::isBLANK_A(ord("\r")));
+
+ok(  Devel::PPPort::isUPPER(ord("A")));
+ok(! Devel::PPPort::isUPPER(ord("a")));
+
+ok(  Devel::PPPort::isUPPER_A(ord("Z")));
+
+# One of these two is uppercase in EBCDIC; the other in Latin1, but neither are
+# ASCII uppercase.
+ok(! Devel::PPPort::isUPPER_A(ord(0xDC)));
+ok(! Devel::PPPort::isUPPER_A(ord(0xFC)));
+
+ok(  Devel::PPPort::isLOWER(ord("b")));
+ok(! Devel::PPPort::isLOWER(ord("B")));
+
+ok(  Devel::PPPort::isLOWER_A(ord("y")));
+
+# One of these two is lowercase in EBCDIC; the other in Latin1, but neither are
+# ASCII lowercase.
+ok(! Devel::PPPort::isLOWER_A(ord(0xDC)));
+ok(! Devel::PPPort::isLOWER_A(ord(0xFC)));
+
+ok(  Devel::PPPort::isALPHA(ord("C")));
+ok(! Devel::PPPort::isALPHA(ord("1")));
+
+ok(  Devel::PPPort::isALPHA_A(ord("x")));
+ok(! Devel::PPPort::isALPHA_A(0xDC));
+
+ok(  Devel::PPPort::isWORDCHAR(ord("_")));
+ok(! Devel::PPPort::isWORDCHAR(ord("@")));
+
+ok(  Devel::PPPort::isWORDCHAR_A(ord("2")));
+ok(! Devel::PPPort::isWORDCHAR_A(0xFC));
+
+ok(  Devel::PPPort::isALPHANUMERIC(ord("4")));
+ok(! Devel::PPPort::isALPHANUMERIC(ord("_")));
+
+ok(  Devel::PPPort::isALPHANUMERIC_A(ord("l")));
+ok(! Devel::PPPort::isALPHANUMERIC_A(0xDC));
+
+ok(  Devel::PPPort::isALNUM(ord("c")));
+ok(! Devel::PPPort::isALNUM(ord("}")));
+
+ok(  Devel::PPPort::isALNUM_A(ord("5")));
+ok(! Devel::PPPort::isALNUM_A(0xFC));
+
+ok(  Devel::PPPort::isDIGIT(ord("6")));
+ok(! Devel::PPPort::isDIGIT(ord("_")));
+
+ok(  Devel::PPPort::isDIGIT_A(ord("7")));
+ok(! Devel::PPPort::isDIGIT_A(0xDC));
+
+ok(  Devel::PPPort::isOCTAL(ord("7")));
+ok(! Devel::PPPort::isOCTAL(ord("8")));
+
+ok(  Devel::PPPort::isOCTAL_A(ord("0")));
+ok(! Devel::PPPort::isOCTAL_A(ord("9")));
+
+ok(  Devel::PPPort::isIDFIRST(ord("D")));
+ok(! Devel::PPPort::isIDFIRST(ord("1")));
+
+ok(  Devel::PPPort::isIDFIRST_A(ord("_")));
+ok(! Devel::PPPort::isIDFIRST_A(0xFC));
+
+ok(  Devel::PPPort::isIDCONT(ord("e")));
+ok(! Devel::PPPort::isIDCONT(ord("@")));
+
+ok(  Devel::PPPort::isIDCONT_A(ord("2")));
+ok(! Devel::PPPort::isIDCONT_A(0xDC));
+
+ok(  Devel::PPPort::isSPACE(ord(" ")));
+ok(! Devel::PPPort::isSPACE(ord("_")));
+
+ok(  Devel::PPPort::isSPACE_A(ord("\cK")));
+ok(! Devel::PPPort::isSPACE_A(ord("F")));
+
+# This stresses the edge for ASCII machines, but happens to work on EBCDIC as
+# well
+ok(  Devel::PPPort::isASCII(0x7F));
+ok(! Devel::PPPort::isASCII(0x80));
+
+ok(  Devel::PPPort::isASCII_A(ord("9")));
+
+# B6 is the PARAGRAPH SIGN in ASCII and EBCDIC
+ok(! Devel::PPPort::isASCII_A(0xB6));
+
+ok(  Devel::PPPort::isCNTRL(ord("\e")));
+ok(! Devel::PPPort::isCNTRL(ord(" ")));
+
+ok(  Devel::PPPort::isCNTRL_A(ord("\a")));
+ok(! Devel::PPPort::isCNTRL_A(0xB6));
+
+ok(  Devel::PPPort::isPRINT(ord(" ")));
+ok(! Devel::PPPort::isPRINT(ord("\n")));
+
+ok(  Devel::PPPort::isPRINT_A(ord("G")));
+ok(! Devel::PPPort::isPRINT_A(0xB6));
+
+ok(  Devel::PPPort::isGRAPH(ord("h")));
+ok(! Devel::PPPort::isGRAPH(ord(" ")));
+
+ok(  Devel::PPPort::isGRAPH_A(ord("i")));
+ok(! Devel::PPPort::isGRAPH_A(0xB6));
+
+ok(  Devel::PPPort::isPUNCT(ord("#")));
+ok(! Devel::PPPort::isPUNCT(ord(" ")));
+
+ok(  Devel::PPPort::isPUNCT_A(ord("*")));
+ok(! Devel::PPPort::isPUNCT_A(0xB6));
+
+ok(  Devel::PPPort::isXDIGIT(ord("A")));
+ok(! Devel::PPPort::isXDIGIT(ord("_")));
+
+ok(  Devel::PPPort::isXDIGIT_A(ord("9")));
+ok(! Devel::PPPort::isXDIGIT_A(0xDC));
+
+ok(  Devel::PPPort::isPSXSPC(ord(" ")));
+ok(! Devel::PPPort::isPSXSPC(ord("k")));
+
+ok(  Devel::PPPort::isPSXSPC_A(ord("\cK")));
+ok(! Devel::PPPort::isPSXSPC_A(0xFC));
+
+ok(&Devel::PPPort::av_top_index([1,2,3]), 2);
+ok(&Devel::PPPort::av_tindex([1,2,3,4]), 3);
+