Use already existing functions in some .t files

I invented 2 functions for use in .t files a while back that turn out to
be duplicates of (undocumented) functions that already existed suitable
for general use.  This commit changes to use those general functions and
removes the copies from t/test.pl.  (I plan to document these functions
later in 5.21.).  This is in preparation for moving some similar
functions from t/test.pl to a newly created test tools file, as it turns
out that these functions are useful in .t files that don't use
t/test.pl, but instead, e.g., Test::More.