This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
APItest/t/handy.t: Add more tests
[perl5.git] / ext / XS-APItest / APItest.xs
index 3d8db26..8b4e638 100644 (file)
@@ -3,7 +3,9 @@
 /* We want to be able to test things that aren't API yet. */
 #define PERL_EXT
 
-#define PERL_NO_GET_CONTEXT     /* we wants efficiency */
+/* Do *not* define PERL_NO_GET_CONTEXT.  This is the one place where we get
+   to test implicit Perl_get_context().  */
+
 #include "EXTERN.h"
 #include "perl.h"
 #include "XSUB.h"
@@ -91,7 +93,19 @@ typedef struct {
 
 START_MY_CXT
 
+int
+S_myset_set(pTHX_ SV* sv, MAGIC* mg)
+{
+    SV *isv = (SV*)mg->mg_ptr;
+
+    PERL_UNUSED_ARG(sv);
+    SvIVX(isv)++;
+    return 0;
+}
+
 MGVTBL vtbl_foo, vtbl_bar;
+MGVTBL vtbl_myset = { 0, S_myset_set, 0, 0, 0, 0, 0, 0 };
+
 
 /* indirect functions to test the [pa]MY_CXT macros */
 
@@ -118,7 +132,6 @@ my_cxt_getsv_interp_context(void)
 SV*
 my_cxt_getsv_interp(void)
 {
-    dTHX;
     dMY_CXT;
     return MY_CXT.sv;
 }
@@ -143,7 +156,7 @@ bool sv_setsv_cow_hashkey_notcore(void);
 typedef void (freeent_function)(pTHX_ HV *, HE *);
 
 void
-test_freeent(pTHX_ freeent_function *f) {
+test_freeent(freeent_function *f) {
     dSP;
     HV *test_hash = newHV();
     HE *victim;
@@ -156,8 +169,8 @@ test_freeent(pTHX_ freeent_function *f) {
 #else
     /* Storing then deleting something should ensure that a hash entry is
        available.  */
-    (void) hv_store(test_hash, "", 0, &PL_sv_yes, 0);
-    (void) hv_delete(test_hash, "", 0, 0);
+    (void) hv_stores(test_hash, "", &PL_sv_yes);
+    (void) hv_deletes(test_hash, "", 0);
 
     /* We need to "inline" new_he here as it's static, and the functions we
        test expect to be able to call del_HE on the HE  */
@@ -517,9 +530,9 @@ THX_ck_entersub_multi_sum(pTHX_ OP *entersubop, GV *namegv, SV *ckobj)
     return sumop;
 }
 
-STATIC void test_op_list_describe_part(pTHX_ SV *res, OP *o);
+STATIC void test_op_list_describe_part(SV *res, OP *o);
 STATIC void
-test_op_list_describe_part(pTHX_ SV *res, OP *o)
+test_op_list_describe_part(SV *res, OP *o)
 {
     sv_catpv(res, PL_op_name[o->op_type]);
     switch (o->op_type) {
@@ -531,7 +544,7 @@ test_op_list_describe_part(pTHX_ SV *res, OP *o)
        OP *k;
        sv_catpvs(res, "[");
        for (k = cUNOPx(o)->op_first; k; k = OpSIBLING(k))
-           test_op_list_describe_part(aTHX_ res, k);
+           test_op_list_describe_part(res, k);
        sv_catpvs(res, "]");
     } else {
        sv_catpvs(res, ".");
@@ -539,11 +552,11 @@ test_op_list_describe_part(pTHX_ SV *res, OP *o)
 }
 
 STATIC char *
-test_op_list_describe(pTHX_ OP *o)
+test_op_list_describe(OP *o)
 {
     SV *res = sv_2mortal(newSVpvs(""));
     if (o)
-       test_op_list_describe_part(aTHX_ res, o);
+       test_op_list_describe_part(res, o);
     return SvPVX(res);
 }
 
@@ -587,7 +600,7 @@ THX_mkLISTOP(pTHX_ U32 type, OP *first, OP *sib, OP *last)
 }
 
 static char *
-test_op_linklist_describe(pTHX_ OP *start)
+test_op_linklist_describe(OP *start)
 {
     SV *rv = sv_2mortal(newSVpvs(""));
     OP *o;
@@ -1147,84 +1160,84 @@ static int THX_keyword_active(pTHX_ SV *hintkey_sv)
 static int my_keyword_plugin(pTHX_
     char *keyword_ptr, STRLEN keyword_len, OP **op_ptr)
 {
-    if(keyword_len == 3 && strnEQ(keyword_ptr, "rpn", 3) &&
+    if(keyword_len == 3 && strEQs(keyword_ptr, "rpn") &&
                    keyword_active(hintkey_rpn_sv)) {
        *op_ptr = parse_keyword_rpn();
        return KEYWORD_PLUGIN_EXPR;
-    } else if(keyword_len == 7 && strnEQ(keyword_ptr, "calcrpn", 7) &&
+    } else if(keyword_len == 7 && strEQs(keyword_ptr, "calcrpn") &&
                    keyword_active(hintkey_calcrpn_sv)) {
        *op_ptr = parse_keyword_calcrpn();
        return KEYWORD_PLUGIN_STMT;
-    } else if(keyword_len == 9 && strnEQ(keyword_ptr, "stufftest", 9) &&
+    } else if(keyword_len == 9 && strEQs(keyword_ptr, "stufftest") &&
                    keyword_active(hintkey_stufftest_sv)) {
        *op_ptr = parse_keyword_stufftest();
        return KEYWORD_PLUGIN_STMT;
     } else if(keyword_len == 12 &&
-                   strnEQ(keyword_ptr, "swaptwostmts", 12) &&
+                   strEQs(keyword_ptr, "swaptwostmts") &&
                    keyword_active(hintkey_swaptwostmts_sv)) {
        *op_ptr = parse_keyword_swaptwostmts();
        return KEYWORD_PLUGIN_STMT;
-    } else if(keyword_len == 8 && strnEQ(keyword_ptr, "looprest", 8) &&
+    } else if(keyword_len == 8 && strEQs(keyword_ptr, "looprest") &&
                    keyword_active(hintkey_looprest_sv)) {
        *op_ptr = parse_keyword_looprest();
        return KEYWORD_PLUGIN_STMT;
-    } else if(keyword_len == 14 && strnEQ(keyword_ptr, "scopelessblock", 14) &&
+    } else if(keyword_len == 14 && strEQs(keyword_ptr, "scopelessblock") &&
                    keyword_active(hintkey_scopelessblock_sv)) {
        *op_ptr = parse_keyword_scopelessblock();
        return KEYWORD_PLUGIN_STMT;
-    } else if(keyword_len == 10 && strnEQ(keyword_ptr, "stmtasexpr", 10) &&
+    } else if(keyword_len == 10 && strEQs(keyword_ptr, "stmtasexpr") &&
                    keyword_active(hintkey_stmtasexpr_sv)) {
        *op_ptr = parse_keyword_stmtasexpr();
        return KEYWORD_PLUGIN_EXPR;
-    } else if(keyword_len == 11 && strnEQ(keyword_ptr, "stmtsasexpr", 11) &&
+    } else if(keyword_len == 11 && strEQs(keyword_ptr, "stmtsasexpr") &&
                    keyword_active(hintkey_stmtsasexpr_sv)) {
        *op_ptr = parse_keyword_stmtsasexpr();
        return KEYWORD_PLUGIN_EXPR;
-    } else if(keyword_len == 9 && strnEQ(keyword_ptr, "loopblock", 9) &&
+    } else if(keyword_len == 9 && strEQs(keyword_ptr, "loopblock") &&
                    keyword_active(hintkey_loopblock_sv)) {
        *op_ptr = parse_keyword_loopblock();
        return KEYWORD_PLUGIN_STMT;
-    } else if(keyword_len == 11 && strnEQ(keyword_ptr, "blockasexpr", 11) &&
+    } else if(keyword_len == 11 && strEQs(keyword_ptr, "blockasexpr") &&
                    keyword_active(hintkey_blockasexpr_sv)) {
        *op_ptr = parse_keyword_blockasexpr();
        return KEYWORD_PLUGIN_EXPR;
-    } else if(keyword_len == 9 && strnEQ(keyword_ptr, "swaplabel", 9) &&
+    } else if(keyword_len == 9 && strEQs(keyword_ptr, "swaplabel") &&
                    keyword_active(hintkey_swaplabel_sv)) {
        *op_ptr = parse_keyword_swaplabel();
        return KEYWORD_PLUGIN_STMT;
-    } else if(keyword_len == 10 && strnEQ(keyword_ptr, "labelconst", 10) &&
+    } else if(keyword_len == 10 && strEQs(keyword_ptr, "labelconst") &&
                    keyword_active(hintkey_labelconst_sv)) {
        *op_ptr = parse_keyword_labelconst();
        return KEYWORD_PLUGIN_EXPR;
-    } else if(keyword_len == 13 && strnEQ(keyword_ptr, "arrayfullexpr", 13) &&
+    } else if(keyword_len == 13 && strEQs(keyword_ptr, "arrayfullexpr") &&
                    keyword_active(hintkey_arrayfullexpr_sv)) {
        *op_ptr = parse_keyword_arrayfullexpr();
        return KEYWORD_PLUGIN_EXPR;
-    } else if(keyword_len == 13 && strnEQ(keyword_ptr, "arraylistexpr", 13) &&
+    } else if(keyword_len == 13 && strEQs(keyword_ptr, "arraylistexpr") &&
                    keyword_active(hintkey_arraylistexpr_sv)) {
        *op_ptr = parse_keyword_arraylistexpr();
        return KEYWORD_PLUGIN_EXPR;
-    } else if(keyword_len == 13 && strnEQ(keyword_ptr, "arraytermexpr", 13) &&
+    } else if(keyword_len == 13 && strEQs(keyword_ptr, "arraytermexpr") &&
                    keyword_active(hintkey_arraytermexpr_sv)) {
        *op_ptr = parse_keyword_arraytermexpr();
        return KEYWORD_PLUGIN_EXPR;
-    } else if(keyword_len == 14 && strnEQ(keyword_ptr, "arrayarithexpr", 14) &&
+    } else if(keyword_len == 14 && strEQs(keyword_ptr, "arrayarithexpr") &&
                    keyword_active(hintkey_arrayarithexpr_sv)) {
        *op_ptr = parse_keyword_arrayarithexpr();
        return KEYWORD_PLUGIN_EXPR;
-    } else if(keyword_len == 14 && strnEQ(keyword_ptr, "arrayexprflags", 14) &&
+    } else if(keyword_len == 14 && strEQs(keyword_ptr, "arrayexprflags") &&
                    keyword_active(hintkey_arrayexprflags_sv)) {
        *op_ptr = parse_keyword_arrayexprflags();
        return KEYWORD_PLUGIN_EXPR;
-    } else if(keyword_len == 5 && strnEQ(keyword_ptr, "DEFSV", 5) &&
+    } else if(keyword_len == 5 && strEQs(keyword_ptr, "DEFSV") &&
                    keyword_active(hintkey_DEFSV_sv)) {
        *op_ptr = parse_keyword_DEFSV();
        return KEYWORD_PLUGIN_EXPR;
-    } else if(keyword_len == 9 && strnEQ(keyword_ptr, "with_vars", 9) &&
+    } else if(keyword_len == 9 && strEQs(keyword_ptr, "with_vars") &&
                    keyword_active(hintkey_with_vars_sv)) {
        *op_ptr = parse_keyword_with_vars();
        return KEYWORD_PLUGIN_STMT;
-    } else if(keyword_len == 15 && strnEQ(keyword_ptr, "join_with_space", 15) &&
+    } else if(keyword_len == 15 && strEQs(keyword_ptr, "join_with_space") &&
                    keyword_active(hintkey_join_with_space_sv)) {
        *op_ptr = parse_join_with_space();
        return KEYWORD_PLUGIN_EXPR;
@@ -1245,8 +1258,8 @@ static void
 peep_xop(pTHX_ OP *o, OP *oldop)
 {
     dMY_CXT;
-    av_push(MY_CXT.xop_record, newSVpvf("peep:%"UVxf, PTR2UV(o)));
-    av_push(MY_CXT.xop_record, newSVpvf("oldop:%"UVxf, PTR2UV(oldop)));
+    av_push(MY_CXT.xop_record, newSVpvf("peep:%" UVxf, PTR2UV(o)));
+    av_push(MY_CXT.xop_record, newSVpvf("oldop:%" UVxf, PTR2UV(oldop)));
 }
 
 static I32
@@ -1361,7 +1374,7 @@ bytes_cmp_utf8(bytes, utf8)
        RETVAL
 
 AV *
-test_utf8n_to_uvchr(s, len, flags)
+test_utf8n_to_uvchr_error(s, len, flags)
 
         SV *s
         SV *len
@@ -1370,20 +1383,25 @@ test_utf8n_to_uvchr(s, len, flags)
         STRLEN retlen;
         UV ret;
         STRLEN slen;
+        U32 errors;
 
     CODE:
-        /* Call utf8n_to_uvchr() with the inputs.  It always asks for the
-         * actual length to be returned
+        /* Now that utf8n_to_uvchr() is a trivial wrapper for
+         * utf8n_to_uvchr_error(), call the latter with the inputs.  It always
+         * asks for the actual length to be returned and errors to be returned
          *
          * Length to assume <s> is; not checked, so could have buffer overflow
          */
         RETVAL = newAV();
         sv_2mortal((SV*)RETVAL);
 
-        ret
-         = utf8n_to_uvchr((U8*) SvPV(s, slen), SvUV(len), &retlen, SvUV(flags));
+        ret = utf8n_to_uvchr_error((U8*) SvPV(s, slen),
+                                         SvUV(len),
+                                         &retlen,
+                                         SvUV(flags),
+                                         &errors);
 
-        /* Returns the return value in [0]; <retlen> in [1] */
+        /* Returns the return value in [0]; <retlen> in [1], <errors> in [2] */
         av_push(RETVAL, newSVuv(ret));
         if (retlen == (STRLEN) -1) {
             av_push(RETVAL, newSViv(-1));
@@ -1391,6 +1409,7 @@ test_utf8n_to_uvchr(s, len, flags)
         else {
             av_push(RETVAL, newSVuv(retlen));
         }
+        av_push(RETVAL, newSVuv(errors));
 
     OUTPUT:
         RETVAL
@@ -1795,13 +1814,13 @@ common(params)
 void
 test_hv_free_ent()
        PPCODE:
-       test_freeent(aTHX_ &Perl_hv_free_ent);
+       test_freeent(&Perl_hv_free_ent);
        XSRETURN(4);
 
 void
 test_hv_delayfree_ent()
        PPCODE:
-       test_freeent(aTHX_ &Perl_hv_delayfree_ent);
+       test_freeent(&Perl_hv_delayfree_ent);
        XSRETURN(4);
 
 SV *
@@ -1830,7 +1849,7 @@ refcounted_he_exists(key, level=0)
        IV level
        CODE:
        if (level) {
-           croak("level must be zero, not %"IVdf, level);
+           croak("level must be zero, not %" IVdf, level);
        }
        RETVAL = (cop_hints_fetch_sv(PL_curcop, key, 0, 0) != &PL_sv_placeholder);
        OUTPUT:
@@ -1842,7 +1861,7 @@ refcounted_he_fetch(key, level=0)
        IV level
        CODE:
        if (level) {
-           croak("level must be zero, not %"IVdf, level);
+           croak("level must be zero, not %" IVdf, level);
        }
        RETVAL = cop_hints_fetch_sv(PL_curcop, key, 0, 0);
        SvREFCNT_inc(RETVAL);
@@ -2050,8 +2069,8 @@ xop_build_optree ()
         unop->op_next       = NULL;
         kid->op_next        = (OP*)unop;
 
-        av_push(MY_CXT.xop_record, newSVpvf("unop:%"UVxf, PTR2UV(unop)));
-        av_push(MY_CXT.xop_record, newSVpvf("kid:%"UVxf, PTR2UV(kid)));
+        av_push(MY_CXT.xop_record, newSVpvf("unop:%" UVxf, PTR2UV(unop)));
+        av_push(MY_CXT.xop_record, newSVpvf("kid:%" UVxf, PTR2UV(kid)));
 
         av_push(MY_CXT.xop_record, newSVpvf("NAME:%s", OP_NAME((OP*)unop)));
         av_push(MY_CXT.xop_record, newSVpvf("DESC:%s", OP_DESC((OP*)unop)));
@@ -2570,6 +2589,9 @@ gv_fetchmethod_flags_type(stash, methname, type, flags)
                gv = gv_fetchmethod_pvn_flags(stash, name, len, flags | SvUTF8(methname));
                break;
             }
+           case 4:
+               gv = gv_fetchmethod_pvn_flags(stash, SvPV_nolen(methname),
+                                             flags, SvUTF8(methname));
         }
        XPUSHs( gv ? (SV*)gv : &PL_sv_undef);
 
@@ -3428,8 +3450,8 @@ test_op_list()
 #define iv_op(iv) newSVOP(OP_CONST, 0, newSViv(iv))
 #define check_op(o, expect) \
     do { \
-       if (strcmp(test_op_list_describe(aTHX_ o), (expect))) \
-           croak("fail %s %s", test_op_list_describe(aTHX_ o),(expect)); \
+       if (strcmp(test_op_list_describe(o), (expect))) \
+           croak("fail %s %s", test_op_list_describe(o), (expect)); \
     } while(0)
        a = op_append_elem(OP_LIST, NULL, NULL);
        check_op(a, "");
@@ -3543,9 +3565,8 @@ test_op_linklist ()
     CODE:
 #define check_ll(o, expect) \
     STMT_START { \
-       if (strNE(test_op_linklist_describe(aTHX_ o), (expect))) \
-           croak("fail %s %s", test_op_linklist_describe(aTHX_ o), \
-                  (expect)); \
+       if (strNE(test_op_linklist_describe(o), (expect))) \
+           croak("fail %s %s", test_op_linklist_describe(o), (expect)); \
     } STMT_END
         o = iv_op(1);
         check_ll(o, ".const1");
@@ -4107,7 +4128,7 @@ lexical_import(SV *name, CV *cv)
        SAVESPTR(PL_comppad_name); PL_comppad_name = PadlistNAMES(pl);
        SAVESPTR(PL_comppad);      PL_comppad      = PadlistARRAY(pl)[1];
        SAVESPTR(PL_curpad);       PL_curpad       = PadARRAY(PL_comppad);
-       off = pad_add_name_sv(sv_2mortal(newSVpvf("&%"SVf,name)),
+       off = pad_add_name_sv(sv_2mortal(newSVpvf("&%" SVf,name)),
                              padadd_STATE, 0, 0);
        SvREFCNT_dec(PL_curpad[off]);
        PL_curpad[off] = SvREFCNT_inc(cv);
@@ -4214,7 +4235,20 @@ CODE:
     } else if (items == 3) {
        Perl_load_module(aTHX_ flags, SvREFCNT_inc(name), SvREFCNT_inc(ST(2)));
     } else
-        Perl_croak(aTHX_ "load_module can't yet support %"IVdf" items", (IV)items);
+        Perl_croak(aTHX_ "load_module can't yet support %" IVdf " items",
+                          (IV)items);
+
+SV *
+string_without_null(SV *sv)
+    CODE:
+    {
+        STRLEN len;
+        const char *s = SvPV(sv, len);
+        RETVAL = newSVpvn_flags(s, len, SvUTF8(sv));
+        *SvEND(RETVAL) = 0xff;
+    }
+    OUTPUT:
+        RETVAL
 
 MODULE = XS::APItest PACKAGE = XS::APItest::AUTOLOADtest
 
@@ -4318,6 +4352,18 @@ test_get_vtbl()
     OUTPUT:
        RETVAL
 
+
+    # attach ext magic to the SV pointed to by rsv that only has set magic,
+    # where that magic's job is to increment thingy
+
+void
+sv_magic_myset(SV *rsv, SV *thingy)
+CODE:
+    sv_magicext(SvRV(rsv), NULL, PERL_MAGIC_ext, &vtbl_myset,
+        (const char *)thingy, 0);
+
+
+
 bool
 test_isBLANK_uni(UV ord)
     CODE:
@@ -4326,6 +4372,13 @@ test_isBLANK_uni(UV ord)
         RETVAL
 
 bool
+test_isBLANK_uvchr(UV ord)
+    CODE:
+        RETVAL = isBLANK_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isBLANK_LC_uvchr(UV ord)
     CODE:
         RETVAL = isBLANK_LC_uvchr(ord);
@@ -4333,6 +4386,13 @@ test_isBLANK_LC_uvchr(UV ord)
         RETVAL
 
 bool
+test_isBLANK(UV ord)
+    CODE:
+        RETVAL = isBLANK(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isBLANK_A(UV ord)
     CODE:
         RETVAL = isBLANK_A(ord);
@@ -4375,6 +4435,13 @@ test_isVERTWS_uni(UV ord)
         RETVAL
 
 bool
+test_isVERTWS_uvchr(UV ord)
+    CODE:
+        RETVAL = isVERTWS_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isVERTWS_utf8(unsigned char * p)
     CODE:
         RETVAL = isVERTWS_utf8(p);
@@ -4389,6 +4456,13 @@ test_isUPPER_uni(UV ord)
         RETVAL
 
 bool
+test_isUPPER_uvchr(UV ord)
+    CODE:
+        RETVAL = isUPPER_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isUPPER_LC_uvchr(UV ord)
     CODE:
         RETVAL = isUPPER_LC_uvchr(ord);
@@ -4396,6 +4470,13 @@ test_isUPPER_LC_uvchr(UV ord)
         RETVAL
 
 bool
+test_isUPPER(UV ord)
+    CODE:
+        RETVAL = isUPPER(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isUPPER_A(UV ord)
     CODE:
         RETVAL = isUPPER_A(ord);
@@ -4438,6 +4519,13 @@ test_isLOWER_uni(UV ord)
         RETVAL
 
 bool
+test_isLOWER_uvchr(UV ord)
+    CODE:
+        RETVAL = isLOWER_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isLOWER_LC_uvchr(UV ord)
     CODE:
         RETVAL = isLOWER_LC_uvchr(ord);
@@ -4445,6 +4533,13 @@ test_isLOWER_LC_uvchr(UV ord)
         RETVAL
 
 bool
+test_isLOWER(UV ord)
+    CODE:
+        RETVAL = isLOWER(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isLOWER_A(UV ord)
     CODE:
         RETVAL = isLOWER_A(ord);
@@ -4487,6 +4582,13 @@ test_isALPHA_uni(UV ord)
         RETVAL
 
 bool
+test_isALPHA_uvchr(UV ord)
+    CODE:
+        RETVAL = isALPHA_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isALPHA_LC_uvchr(UV ord)
     CODE:
         RETVAL = isALPHA_LC_uvchr(ord);
@@ -4494,6 +4596,13 @@ test_isALPHA_LC_uvchr(UV ord)
         RETVAL
 
 bool
+test_isALPHA(UV ord)
+    CODE:
+        RETVAL = isALPHA(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isALPHA_A(UV ord)
     CODE:
         RETVAL = isALPHA_A(ord);
@@ -4536,6 +4645,13 @@ test_isWORDCHAR_uni(UV ord)
         RETVAL
 
 bool
+test_isWORDCHAR_uvchr(UV ord)
+    CODE:
+        RETVAL = isWORDCHAR_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isWORDCHAR_LC_uvchr(UV ord)
     CODE:
         RETVAL = isWORDCHAR_LC_uvchr(ord);
@@ -4543,6 +4659,13 @@ test_isWORDCHAR_LC_uvchr(UV ord)
         RETVAL
 
 bool
+test_isWORDCHAR(UV ord)
+    CODE:
+        RETVAL = isWORDCHAR(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isWORDCHAR_A(UV ord)
     CODE:
         RETVAL = isWORDCHAR_A(ord);
@@ -4585,6 +4708,13 @@ test_isALPHANUMERIC_uni(UV ord)
         RETVAL
 
 bool
+test_isALPHANUMERIC_uvchr(UV ord)
+    CODE:
+        RETVAL = isALPHANUMERIC_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isALPHANUMERIC_LC_uvchr(UV ord)
     CODE:
         RETVAL = isALPHANUMERIC_LC_uvchr(ord);
@@ -4592,6 +4722,13 @@ test_isALPHANUMERIC_LC_uvchr(UV ord)
         RETVAL
 
 bool
+test_isALPHANUMERIC(UV ord)
+    CODE:
+        RETVAL = isALPHANUMERIC(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isALPHANUMERIC_A(UV ord)
     CODE:
         RETVAL = isALPHANUMERIC_A(ord);
@@ -4627,6 +4764,13 @@ test_isALPHANUMERIC_LC_utf8(unsigned char * p)
         RETVAL
 
 bool
+test_isALNUM(UV ord)
+    CODE:
+        RETVAL = isALNUM(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isALNUM_uni(UV ord)
     CODE:
         RETVAL = isALNUM_uni(ord);
@@ -4669,6 +4813,13 @@ test_isDIGIT_uni(UV ord)
         RETVAL
 
 bool
+test_isDIGIT_uvchr(UV ord)
+    CODE:
+        RETVAL = isDIGIT_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isDIGIT_LC_uvchr(UV ord)
     CODE:
         RETVAL = isDIGIT_LC_uvchr(ord);
@@ -4690,6 +4841,13 @@ test_isDIGIT_LC_utf8(unsigned char * p)
         RETVAL
 
 bool
+test_isDIGIT(UV ord)
+    CODE:
+        RETVAL = isDIGIT(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isDIGIT_A(UV ord)
     CODE:
         RETVAL = isDIGIT_A(ord);
@@ -4711,6 +4869,13 @@ test_isDIGIT_LC(UV ord)
         RETVAL
 
 bool
+test_isOCTAL(UV ord)
+    CODE:
+        RETVAL = isOCTAL(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isOCTAL_A(UV ord)
     CODE:
         RETVAL = isOCTAL_A(ord);
@@ -4732,6 +4897,13 @@ test_isIDFIRST_uni(UV ord)
         RETVAL
 
 bool
+test_isIDFIRST_uvchr(UV ord)
+    CODE:
+        RETVAL = isIDFIRST_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isIDFIRST_LC_uvchr(UV ord)
     CODE:
         RETVAL = isIDFIRST_LC_uvchr(ord);
@@ -4739,6 +4911,13 @@ test_isIDFIRST_LC_uvchr(UV ord)
         RETVAL
 
 bool
+test_isIDFIRST(UV ord)
+    CODE:
+        RETVAL = isIDFIRST(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isIDFIRST_A(UV ord)
     CODE:
         RETVAL = isIDFIRST_A(ord);
@@ -4781,6 +4960,13 @@ test_isIDCONT_uni(UV ord)
         RETVAL
 
 bool
+test_isIDCONT_uvchr(UV ord)
+    CODE:
+        RETVAL = isIDCONT_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isIDCONT_LC_uvchr(UV ord)
     CODE:
         RETVAL = isIDCONT_LC_uvchr(ord);
@@ -4788,6 +4974,13 @@ test_isIDCONT_LC_uvchr(UV ord)
         RETVAL
 
 bool
+test_isIDCONT(UV ord)
+    CODE:
+        RETVAL = isIDCONT(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isIDCONT_A(UV ord)
     CODE:
         RETVAL = isIDCONT_A(ord);
@@ -4830,6 +5023,13 @@ test_isSPACE_uni(UV ord)
         RETVAL
 
 bool
+test_isSPACE_uvchr(UV ord)
+    CODE:
+        RETVAL = isSPACE_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isSPACE_LC_uvchr(UV ord)
     CODE:
         RETVAL = isSPACE_LC_uvchr(ord);
@@ -4837,6 +5037,13 @@ test_isSPACE_LC_uvchr(UV ord)
         RETVAL
 
 bool
+test_isSPACE(UV ord)
+    CODE:
+        RETVAL = isSPACE(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isSPACE_A(UV ord)
     CODE:
         RETVAL = isSPACE_A(ord);
@@ -4879,6 +5086,13 @@ test_isASCII_uni(UV ord)
         RETVAL
 
 bool
+test_isASCII_uvchr(UV ord)
+    CODE:
+        RETVAL = isASCII_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isASCII_LC_uvchr(UV ord)
     CODE:
         RETVAL = isASCII_LC_uvchr(ord);
@@ -4886,6 +5100,13 @@ test_isASCII_LC_uvchr(UV ord)
         RETVAL
 
 bool
+test_isASCII(UV ord)
+    CODE:
+        RETVAL = isASCII(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isASCII_A(UV ord)
     CODE:
         RETVAL = isASCII_A(ord);
@@ -4928,6 +5149,13 @@ test_isCNTRL_uni(UV ord)
         RETVAL
 
 bool
+test_isCNTRL_uvchr(UV ord)
+    CODE:
+        RETVAL = isCNTRL_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isCNTRL_LC_uvchr(UV ord)
     CODE:
         RETVAL = isCNTRL_LC_uvchr(ord);
@@ -4935,6 +5163,13 @@ test_isCNTRL_LC_uvchr(UV ord)
         RETVAL
 
 bool
+test_isCNTRL(UV ord)
+    CODE:
+        RETVAL = isCNTRL(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isCNTRL_A(UV ord)
     CODE:
         RETVAL = isCNTRL_A(ord);
@@ -4977,6 +5212,13 @@ test_isPRINT_uni(UV ord)
         RETVAL
 
 bool
+test_isPRINT_uvchr(UV ord)
+    CODE:
+        RETVAL = isPRINT_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isPRINT_LC_uvchr(UV ord)
     CODE:
         RETVAL = isPRINT_LC_uvchr(ord);
@@ -4984,6 +5226,13 @@ test_isPRINT_LC_uvchr(UV ord)
         RETVAL
 
 bool
+test_isPRINT(UV ord)
+    CODE:
+        RETVAL = isPRINT(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isPRINT_A(UV ord)
     CODE:
         RETVAL = isPRINT_A(ord);
@@ -5026,6 +5275,13 @@ test_isGRAPH_uni(UV ord)
         RETVAL
 
 bool
+test_isGRAPH_uvchr(UV ord)
+    CODE:
+        RETVAL = isGRAPH_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isGRAPH_LC_uvchr(UV ord)
     CODE:
         RETVAL = isGRAPH_LC_uvchr(ord);
@@ -5033,6 +5289,13 @@ test_isGRAPH_LC_uvchr(UV ord)
         RETVAL
 
 bool
+test_isGRAPH(UV ord)
+    CODE:
+        RETVAL = isGRAPH(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isGRAPH_A(UV ord)
     CODE:
         RETVAL = isGRAPH_A(ord);
@@ -5075,6 +5338,13 @@ test_isPUNCT_uni(UV ord)
         RETVAL
 
 bool
+test_isPUNCT_uvchr(UV ord)
+    CODE:
+        RETVAL = isPUNCT_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isPUNCT_LC_uvchr(UV ord)
     CODE:
         RETVAL = isPUNCT_LC_uvchr(ord);
@@ -5082,6 +5352,13 @@ test_isPUNCT_LC_uvchr(UV ord)
         RETVAL
 
 bool
+test_isPUNCT(UV ord)
+    CODE:
+        RETVAL = isPUNCT(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isPUNCT_A(UV ord)
     CODE:
         RETVAL = isPUNCT_A(ord);
@@ -5124,6 +5401,13 @@ test_isXDIGIT_uni(UV ord)
         RETVAL
 
 bool
+test_isXDIGIT_uvchr(UV ord)
+    CODE:
+        RETVAL = isXDIGIT_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isXDIGIT_LC_uvchr(UV ord)
     CODE:
         RETVAL = isXDIGIT_LC_uvchr(ord);
@@ -5131,6 +5415,13 @@ test_isXDIGIT_LC_uvchr(UV ord)
         RETVAL
 
 bool
+test_isXDIGIT(UV ord)
+    CODE:
+        RETVAL = isXDIGIT(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isXDIGIT_A(UV ord)
     CODE:
         RETVAL = isXDIGIT_A(ord);
@@ -5173,6 +5464,13 @@ test_isPSXSPC_uni(UV ord)
         RETVAL
 
 bool
+test_isPSXSPC_uvchr(UV ord)
+    CODE:
+        RETVAL = isPSXSPC_uvchr(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isPSXSPC_LC_uvchr(UV ord)
     CODE:
         RETVAL = isPSXSPC_LC_uvchr(ord);
@@ -5180,6 +5478,13 @@ test_isPSXSPC_LC_uvchr(UV ord)
         RETVAL
 
 bool
+test_isPSXSPC(UV ord)
+    CODE:
+        RETVAL = isPSXSPC(ord);
+    OUTPUT:
+        RETVAL
+
+bool
 test_isPSXSPC_A(UV ord)
     CODE:
         RETVAL = isPSXSPC_A(ord);
@@ -5305,6 +5610,231 @@ test_isUTF8_POSSIBLY_PROBLEMATIC(char ch)
     OUTPUT:
         RETVAL
 
+STRLEN
+test_isUTF8_CHAR(char *s, STRLEN len)
+    CODE:
+        RETVAL = isUTF8_CHAR((U8 *) s, (U8 *) s + len);
+    OUTPUT:
+        RETVAL
+
+STRLEN
+test_isUTF8_CHAR_flags(char *s, STRLEN len, U32 flags)
+    CODE:
+        RETVAL = isUTF8_CHAR_flags((U8 *) s, (U8 *) s + len, flags);
+    OUTPUT:
+        RETVAL
+
+STRLEN
+test_isSTRICT_UTF8_CHAR(char *s, STRLEN len)
+    CODE:
+        RETVAL = isSTRICT_UTF8_CHAR((U8 *) s, (U8 *) s + len);
+    OUTPUT:
+        RETVAL
+
+STRLEN
+test_isC9_STRICT_UTF8_CHAR(char *s, STRLEN len)
+    CODE:
+        RETVAL = isC9_STRICT_UTF8_CHAR((U8 *) s, (U8 *) s + len);
+    OUTPUT:
+        RETVAL
+
+IV
+test_is_utf8_valid_partial_char_flags(char *s, STRLEN len, U32 flags)
+    CODE:
+        /* RETVAL should be bool (here and in tests below), but making it IV
+         * allows us to test it returning 0 or 1 */
+        RETVAL = is_utf8_valid_partial_char_flags((U8 *) s, (U8 *) s + len, flags);
+    OUTPUT:
+        RETVAL
+
+IV
+test_is_utf8_string(char *s, STRLEN len)
+    CODE:
+        RETVAL = is_utf8_string((U8 *) s, len);
+    OUTPUT:
+        RETVAL
+
+AV *
+test_is_utf8_string_loc(char *s, STRLEN len)
+    PREINIT:
+        AV *av;
+        const U8 * ep;
+    CODE:
+        av = newAV();
+        av_push(av, newSViv(is_utf8_string_loc((U8 *) s, len, &ep)));
+        av_push(av, newSViv(ep - (U8 *) s));
+        RETVAL = av;
+    OUTPUT:
+        RETVAL
+
+AV *
+test_is_utf8_string_loclen(char *s, STRLEN len)
+    PREINIT:
+        AV *av;
+        STRLEN ret_len;
+        const U8 * ep;
+    CODE:
+        av = newAV();
+        av_push(av, newSViv(is_utf8_string_loclen((U8 *) s, len, &ep, &ret_len)));
+        av_push(av, newSViv(ep - (U8 *) s));
+        av_push(av, newSVuv(ret_len));
+        RETVAL = av;
+    OUTPUT:
+        RETVAL
+
+IV
+test_is_utf8_string_flags(char *s, STRLEN len, U32 flags)
+    CODE:
+        RETVAL = is_utf8_string_flags((U8 *) s, len, flags);
+    OUTPUT:
+        RETVAL
+
+AV *
+test_is_utf8_string_loc_flags(char *s, STRLEN len, U32 flags)
+    PREINIT:
+        AV *av;
+        const U8 * ep;
+    CODE:
+        av = newAV();
+        av_push(av, newSViv(is_utf8_string_loc_flags((U8 *) s, len, &ep, flags)));
+        av_push(av, newSViv(ep - (U8 *) s));
+        RETVAL = av;
+    OUTPUT:
+        RETVAL
+
+AV *
+test_is_utf8_string_loclen_flags(char *s, STRLEN len, U32 flags)
+    PREINIT:
+        AV *av;
+        STRLEN ret_len;
+        const U8 * ep;
+    CODE:
+        av = newAV();
+        av_push(av, newSViv(is_utf8_string_loclen_flags((U8 *) s, len, &ep, &ret_len, flags)));
+        av_push(av, newSViv(ep - (U8 *) s));
+        av_push(av, newSVuv(ret_len));
+        RETVAL = av;
+    OUTPUT:
+        RETVAL
+
+IV
+test_is_strict_utf8_string(char *s, STRLEN len)
+    CODE:
+        RETVAL = is_strict_utf8_string((U8 *) s, len);
+    OUTPUT:
+        RETVAL
+
+AV *
+test_is_strict_utf8_string_loc(char *s, STRLEN len)
+    PREINIT:
+        AV *av;
+        const U8 * ep;
+    CODE:
+        av = newAV();
+        av_push(av, newSViv(is_strict_utf8_string_loc((U8 *) s, len, &ep)));
+        av_push(av, newSViv(ep - (U8 *) s));
+        RETVAL = av;
+    OUTPUT:
+        RETVAL
+
+AV *
+test_is_strict_utf8_string_loclen(char *s, STRLEN len)
+    PREINIT:
+        AV *av;
+        STRLEN ret_len;
+        const U8 * ep;
+    CODE:
+        av = newAV();
+        av_push(av, newSViv(is_strict_utf8_string_loclen((U8 *) s, len, &ep, &ret_len)));
+        av_push(av, newSViv(ep - (U8 *) s));
+        av_push(av, newSVuv(ret_len));
+        RETVAL = av;
+    OUTPUT:
+        RETVAL
+
+IV
+test_is_c9strict_utf8_string(char *s, STRLEN len)
+    CODE:
+        RETVAL = is_c9strict_utf8_string((U8 *) s, len);
+    OUTPUT:
+        RETVAL
+
+AV *
+test_is_c9strict_utf8_string_loc(char *s, STRLEN len)
+    PREINIT:
+        AV *av;
+        const U8 * ep;
+    CODE:
+        av = newAV();
+        av_push(av, newSViv(is_c9strict_utf8_string_loc((U8 *) s, len, &ep)));
+        av_push(av, newSViv(ep - (U8 *) s));
+        RETVAL = av;
+    OUTPUT:
+        RETVAL
+
+AV *
+test_is_c9strict_utf8_string_loclen(char *s, STRLEN len)
+    PREINIT:
+        AV *av;
+        STRLEN ret_len;
+        const U8 * ep;
+    CODE:
+        av = newAV();
+        av_push(av, newSViv(is_c9strict_utf8_string_loclen((U8 *) s, len, &ep, &ret_len)));
+        av_push(av, newSViv(ep - (U8 *) s));
+        av_push(av, newSVuv(ret_len));
+        RETVAL = av;
+    OUTPUT:
+        RETVAL
+
+IV
+test_is_utf8_fixed_width_buf_flags(char *s, STRLEN len, U32 flags)
+    CODE:
+        RETVAL = is_utf8_fixed_width_buf_flags((U8 *) s, len, flags);
+    OUTPUT:
+        RETVAL
+
+AV *
+test_is_utf8_fixed_width_buf_loc_flags(char *s, STRLEN len, U32 flags)
+    PREINIT:
+        AV *av;
+        const U8 * ep;
+    CODE:
+        av = newAV();
+        av_push(av, newSViv(is_utf8_fixed_width_buf_loc_flags((U8 *) s, len, &ep, flags)));
+        av_push(av, newSViv(ep - (U8 *) s));
+        RETVAL = av;
+    OUTPUT:
+        RETVAL
+
+AV *
+test_is_utf8_fixed_width_buf_loclen_flags(char *s, STRLEN len, U32 flags)
+    PREINIT:
+        AV *av;
+        STRLEN ret_len;
+        const U8 * ep;
+    CODE:
+        av = newAV();
+        av_push(av, newSViv(is_utf8_fixed_width_buf_loclen_flags((U8 *) s, len, &ep, &ret_len, flags)));
+        av_push(av, newSViv(ep - (U8 *) s));
+        av_push(av, newSVuv(ret_len));
+        RETVAL = av;
+    OUTPUT:
+        RETVAL
+
+IV
+test_utf8_hop_safe(SV *s_sv, STRLEN s_off, IV off)
+    PREINIT:
+        STRLEN len;
+        U8 *p;
+        U8 *r;
+    CODE:
+        p = (U8 *)SvPV(s_sv, len);
+        r = utf8_hop_safe(p + s_off, off, p, p + len);
+        RETVAL = r - p;
+    OUTPUT:
+        RETVAL
+
 UV
 test_toLOWER(UV ord)
     CODE:
@@ -5347,6 +5877,26 @@ test_toLOWER_uni(UV ord)
         RETVAL
 
 AV *
+test_toLOWER_uvchr(UV ord)
+    PREINIT:
+        U8 s[UTF8_MAXBYTES_CASE + 1];
+        STRLEN len;
+        AV *av;
+        SV *utf8;
+    CODE:
+        av = newAV();
+        av_push(av, newSVuv(toLOWER_uvchr(ord, s, &len)));
+
+        utf8 = newSVpvn((char *) s, len);
+        SvUTF8_on(utf8);
+        av_push(av, utf8);
+
+        av_push(av, newSVuv(len));
+        RETVAL = av;
+    OUTPUT:
+        RETVAL
+
+AV *
 test_toLOWER_utf8(SV * p)
     PREINIT:
         U8 *input;
@@ -5403,6 +5953,26 @@ test_toFOLD_uni(UV ord)
         RETVAL
 
 AV *
+test_toFOLD_uvchr(UV ord)
+    PREINIT:
+        U8 s[UTF8_MAXBYTES_CASE + 1];
+        STRLEN len;
+        AV *av;
+        SV *utf8;
+    CODE:
+        av = newAV();
+        av_push(av, newSVuv(toFOLD_uvchr(ord, s, &len)));
+
+        utf8 = newSVpvn((char *) s, len);
+        SvUTF8_on(utf8);
+        av_push(av, utf8);
+
+        av_push(av, newSVuv(len));
+        RETVAL = av;
+    OUTPUT:
+        RETVAL
+
+AV *
 test_toFOLD_utf8(SV * p)
     PREINIT:
         U8 *input;
@@ -5459,6 +6029,26 @@ test_toUPPER_uni(UV ord)
         RETVAL
 
 AV *
+test_toUPPER_uvchr(UV ord)
+    PREINIT:
+        U8 s[UTF8_MAXBYTES_CASE + 1];
+        STRLEN len;
+        AV *av;
+        SV *utf8;
+    CODE:
+        av = newAV();
+        av_push(av, newSVuv(toUPPER_uvchr(ord, s, &len)));
+
+        utf8 = newSVpvn((char *) s, len);
+        SvUTF8_on(utf8);
+        av_push(av, utf8);
+
+        av_push(av, newSVuv(len));
+        RETVAL = av;
+    OUTPUT:
+        RETVAL
+
+AV *
 test_toUPPER_utf8(SV * p)
     PREINIT:
         U8 *input;
@@ -5508,6 +6098,26 @@ test_toTITLE_uni(UV ord)
         RETVAL
 
 AV *
+test_toTITLE_uvchr(UV ord)
+    PREINIT:
+        U8 s[UTF8_MAXBYTES_CASE + 1];
+        STRLEN len;
+        AV *av;
+        SV *utf8;
+    CODE:
+        av = newAV();
+        av_push(av, newSVuv(toTITLE_uvchr(ord, s, &len)));
+
+        utf8 = newSVpvn((char *) s, len);
+        SvUTF8_on(utf8);
+        av_push(av, utf8);
+
+        av_push(av, newSVuv(len));
+        RETVAL = av;
+    OUTPUT:
+        RETVAL
+
+AV *
 test_toTITLE_utf8(SV * p)
     PREINIT:
         U8 *input;