enhanced more hawk script test cases with the tap protocol
This commit is contained in:
parent
df9106337c
commit
7b93fe61ed
@ -87,8 +87,7 @@ static hawk_oow_t push_args_from_stack (hawk_rtx_t* rtx, hawk_nde_fncall_t* call
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* TODO: verify if R must be checked here.. */
|
if (spec == 'r') /* 'R' allows a normal value. so only checking 'r' here */
|
||||||
if (spec == 'r')
|
|
||||||
{
|
{
|
||||||
hawk_rtx_seterrnum (rtx, &call->loc, HAWK_ENOTREF);
|
hawk_rtx_seterrnum (rtx, &call->loc, HAWK_ENOTREF);
|
||||||
return (hawk_oow_t)-1;
|
return (hawk_oow_t)-1;
|
||||||
@ -160,7 +159,6 @@ static int fnc_call (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
|
|||||||
call.nargs = nargs - 1;
|
call.nargs = nargs - 1;
|
||||||
/* keep HAWK_NULL in call.args so that hawk_rtx_evalcall() knows it's a fake call structure */
|
/* keep HAWK_NULL in call.args so that hawk_rtx_evalcall() knows it's a fake call structure */
|
||||||
call.arg_base = rtx->stack_base + 5; /* 5 = 4(stack frame prologue) + 1(the first argument to hawk::call()) */
|
call.arg_base = rtx->stack_base + 5; /* 5 = 4(stack frame prologue) + 1(the first argument to hawk::call()) */
|
||||||
//pafs.fun = fun;
|
|
||||||
|
|
||||||
pafs.stack_base = rtx->stack_base;
|
pafs.stack_base = rtx->stack_base;
|
||||||
pafs.start_index = 1;
|
pafs.start_index = 1;
|
||||||
|
@ -6653,8 +6653,9 @@ static HAWK_INLINE hawk_val_t* eval_fncall_fun (hawk_rtx_t* rtx, hawk_nde_t* nde
|
|||||||
* a reference is passed to a built-in function as a reference value
|
* a reference is passed to a built-in function as a reference value
|
||||||
* but its evaluation result is passed to user-defined function.
|
* but its evaluation result is passed to user-defined function.
|
||||||
* I pass HAWK_NULL to prevent special handling.
|
* I pass HAWK_NULL to prevent special handling.
|
||||||
* the value change for a reference variable inside a user-defined function is reflected by hawk_rtx_evalcall()
|
* the value change for a reference variable inside a user-defined function is
|
||||||
* specially whereas a built-in function must call hawk_rtx_setrefval() to update the reference
|
* reflected by hawk_rtx_evalcall() specially whereas a built-in function must
|
||||||
|
* call hawk_rtx_setrefval() to update the reference.
|
||||||
*/
|
*/
|
||||||
return hawk_rtx_evalcall(rtx, call, fun, push_arg_from_nde, HAWK_NULL/*fun->argspec*/, HAWK_NULL, HAWK_NULL);
|
return hawk_rtx_evalcall(rtx, call, fun, push_arg_from_nde, HAWK_NULL/*fun->argspec*/, HAWK_NULL, HAWK_NULL);
|
||||||
}
|
}
|
||||||
|
@ -58,5 +58,6 @@ LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/ac/tap-driver.sh
|
|||||||
TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
|
TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
|
||||||
|
|
||||||
TEST_EXTENSIONS = .hawk
|
TEST_EXTENSIONS = .hawk
|
||||||
|
HAWK_LOG_DRIVER = $(LOG_DRIVER)
|
||||||
HAWK_LOG_COMPILER = ../bin/hawk
|
HAWK_LOG_COMPILER = ../bin/hawk
|
||||||
AM_HAWK_LOG_FLAGS = -vTDIR=${abs_srcdir} --modlibdirs=../lib/.libs:../mod/.libs -f
|
AM_HAWK_LOG_FLAGS = -vTDIR=${abs_srcdir} --modlibdirs=../lib/.libs:../mod/.libs -f
|
||||||
|
@ -411,11 +411,9 @@ am__set_b = \
|
|||||||
am__test_logs1 = $(TESTS:=.log)
|
am__test_logs1 = $(TESTS:=.log)
|
||||||
am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
|
am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
|
||||||
TEST_LOGS = $(am__test_logs2:.hawk.log=.log)
|
TEST_LOGS = $(am__test_logs2:.hawk.log=.log)
|
||||||
HAWK_LOG_DRIVER = $(SHELL) $(top_srcdir)/ac/test-driver
|
|
||||||
HAWK_LOG_COMPILE = $(HAWK_LOG_COMPILER) $(AM_HAWK_LOG_FLAGS) \
|
HAWK_LOG_COMPILE = $(HAWK_LOG_COMPILER) $(AM_HAWK_LOG_FLAGS) \
|
||||||
$(HAWK_LOG_FLAGS)
|
$(HAWK_LOG_FLAGS)
|
||||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/ac/depcomp \
|
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/ac/depcomp
|
||||||
$(top_srcdir)/ac/test-driver
|
|
||||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
ACLOCAL = @ACLOCAL@
|
ACLOCAL = @ACLOCAL@
|
||||||
AMTAR = @AMTAR@
|
AMTAR = @AMTAR@
|
||||||
@ -611,6 +609,7 @@ t_006_LDADD = $(LIBADD_COMMON)
|
|||||||
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/ac/tap-driver.sh
|
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/ac/tap-driver.sh
|
||||||
TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
|
TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
|
||||||
TEST_EXTENSIONS = .hawk
|
TEST_EXTENSIONS = .hawk
|
||||||
|
HAWK_LOG_DRIVER = $(LOG_DRIVER)
|
||||||
HAWK_LOG_COMPILER = ../bin/hawk
|
HAWK_LOG_COMPILER = ../bin/hawk
|
||||||
AM_HAWK_LOG_FLAGS = -vTDIR=${abs_srcdir} --modlibdirs=../lib/.libs:../mod/.libs -f
|
AM_HAWK_LOG_FLAGS = -vTDIR=${abs_srcdir} --modlibdirs=../lib/.libs:../mod/.libs -f
|
||||||
all: all-am
|
all: all-am
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
function ensure (a, b, desc, line)
|
|
||||||
{
|
|
||||||
if (a != b)
|
|
||||||
{
|
|
||||||
printf ("FAILURE[%d] %s\n", line, desc);
|
|
||||||
exit (-1);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,7 @@
|
|||||||
@pragma entry main
|
@pragma entry main
|
||||||
@pragma implicit off
|
@pragma implicit off
|
||||||
|
|
||||||
@include "ensure.inc";
|
@include "tap.inc";
|
||||||
|
|
||||||
function f(a, b, c)
|
function f(a, b, c)
|
||||||
{
|
{
|
||||||
@ -29,106 +29,106 @@ function call_by_ref_3(&x)
|
|||||||
function main()
|
function main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
ensure (@b"" !== "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (@b"" !== "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (@b"" === "", 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (@b"" === "", 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (@b"" != "", 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (@b"" != "", 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (@b"" == "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (@b"" == "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (@b' ' !== ' ', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (@b' ' !== ' ', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (@b' ' === ' ', 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (@b' ' === ' ', 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (@b' ' != ' ', 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (@b' ' != ' ', 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (@b' ' == ' ', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (@b' ' == ' ', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((@nil == 'A'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@nil == 'A'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@nil != 'A'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@nil != 'A'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@nil > 'A'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@nil > 'A'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@nil < 'A'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@nil < 'A'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@nil >= 'A'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@nil >= 'A'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@nil <= 'A'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@nil <= 'A'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((@nil == @b'A'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@nil == @b'A'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@nil != @b'A'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@nil != @b'A'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@nil > @b'A'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@nil > @b'A'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@nil < @b'A'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@nil < @b'A'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@nil >= @b'A'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@nil >= @b'A'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@nil <= @b'A'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@nil <= @b'A'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (('A' == @b'A'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (('A' == @b'A'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (('\u00FF' == @b'\xFF'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (('\u00FF' == @b'\xFF'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (('A' < @b'\xFF'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (('A' < @b'\xFF'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@b'A' < @b'\xFF'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b'A' < @b'\xFF'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (('A' > @b'\xFF'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (('A' > @b'\xFF'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@b'A' > @b'\xFF'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b'A' > @b'\xFF'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (('A' < @b'B'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (('A' < @b'B'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@b'A' < @b'B'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b'A' < @b'B'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (('A' > @b'B'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (('A' > @b'B'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@b'A' > @b'B'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b'A' > @b'B'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (("10" == 10), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("10" == 10), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (("10" == 10.00), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("10" == 10.00), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (("10.0" == 10), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("10.0" == 10), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (("10.00" == 10), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("10.00" == 10), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((@b"10" == 10), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b"10" == 10), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@b"10" == 10.00), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b"10" == 10.00), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@b"10.0" == 10), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b"10.0" == 10), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@b"10.00" == 10), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b"10.00" == 10), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((79 < '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((79 < '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((79 <= '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((79 <= '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((79 > '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((79 > '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((79 >= '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((79 >= '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((79 == '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((79 == '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((79 != '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((79 != '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((99 < '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((99 < '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((99 <= '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((99 <= '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((99 > '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((99 > '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((99 >= '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((99 >= '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((99 == '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((99 == '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((99 != '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((99 != '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((8 < '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8 < '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8 <= '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8 <= '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8 > '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8 > '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8 >= '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8 >= '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8 == '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8 == '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8 != '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8 != '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((8.00 < '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8.00 < '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8.00 <= '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8.00 <= '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8.00 > '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8.00 > '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8.00 >= '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8.00 >= '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8.00 == '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8.00 == '8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8.00 != '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8.00 != '8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((79 < @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((79 < @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((79 <= @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((79 <= @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((79 > @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((79 > @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((79 >= @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((79 >= @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((79 == @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((79 == @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((79 != @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((79 != @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((99 < @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((99 < @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((99 <= @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((99 <= @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((99 > @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((99 > @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((99 >= @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((99 >= @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((99 == @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((99 == @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((99 != @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((99 != @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((8 < @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8 < @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8 <= @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8 <= @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8 > @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8 > @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8 >= @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8 >= @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8 == @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8 == @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8 != @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8 != @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((8.00 < @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8.00 < @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8.00 <= @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8.00 <= @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8.00 > @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8.00 > @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8.00 >= @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8.00 >= @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8.00 == @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8.00 == @b'8'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((8.00 != @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((8.00 != @b'8'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -137,10 +137,10 @@ function main()
|
|||||||
x = 20;
|
x = 20;
|
||||||
y = 90;
|
y = 90;
|
||||||
r = call_by_ref_1(x, y, z);
|
r = call_by_ref_1(x, y, z);
|
||||||
ensure (r, 1800, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (r, 1800, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (x, 20);
|
tap_ensure (x, 20, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y, 90);
|
tap_ensure (y, 90, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (z, "hello, world");
|
tap_ensure (z, "hello, world", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
## TODO: add a new special word, @FILENAME, @FILELINE, @LINE <--- which are understood by the parser and swapped to the actual value
|
## TODO: add a new special word, @FILENAME, @FILELINE, @LINE <--- which are understood by the parser and swapped to the actual value
|
||||||
@ -149,30 +149,30 @@ function main()
|
|||||||
{
|
{
|
||||||
@local b;
|
@local b;
|
||||||
call_by_ref_2(99, b);
|
call_by_ref_2(99, b);
|
||||||
ensure (b[1], 0);
|
tap_ensure (b[1], 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@local b, r;
|
@local b, r;
|
||||||
b[1] = 1;
|
b[1] = 1;
|
||||||
r = call_by_ref_2(99, b);
|
r = call_by_ref_2(99, b);
|
||||||
ensure (r, 99);
|
tap_ensure (r, 99, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (b[1], 99);
|
tap_ensure (b[1], 99, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@local b, r;
|
@local b, r;
|
||||||
b[1] = 1;
|
b[1] = 1;
|
||||||
r = hawk::call("call_by_ref_2", 99, b);
|
r = hawk::call("call_by_ref_2", 99, b);
|
||||||
ensure (r, 99);
|
tap_ensure (r, 99, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (length(b), 2, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (length(b), 2, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (b[1], 99, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (b[1], 99, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (b[2], "perfect", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (b[2], "perfect", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (hawk::call('f', 1, 2, 3), 6, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::call('f', 1, 2, 3), 6, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (hawk::call("f", 1, 2, 3), 6, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::call("f", 1, 2, 3), 6, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (hawk::call(@b'f', 1, 2, 3), 6, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::call(@b'f', 1, 2, 3), 6, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (hawk::call(@b"f", 1, 2, 3), 6, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::call(@b"f", 1, 2, 3), 6, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -180,11 +180,11 @@ function main()
|
|||||||
@local a;
|
@local a;
|
||||||
a[1] = hawk::array();
|
a[1] = hawk::array();
|
||||||
a[1][2]=20;
|
a[1][2]=20;
|
||||||
ensure (a[1][2], 20, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1][2], 20, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
a[1][2]++;
|
a[1][2]++;
|
||||||
ensure (a[1][2], 21, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1][2], 21, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
--a[1][2];
|
--a[1][2];
|
||||||
ensure (a[1][2], 20, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1][2], 20, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -193,24 +193,24 @@ function main()
|
|||||||
a[10] = "good";
|
a[10] = "good";
|
||||||
a[0][40] = "bye"
|
a[0][40] = "bye"
|
||||||
a[0][0] = "farewell"
|
a[0][0] = "farewell"
|
||||||
ensure (hawk::typename(a), "array", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::typename(a), "array", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (hawk::typename(a[0]), "array", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::typename(a[0]), "array", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
call_by_ref_3(a[9]);
|
call_by_ref_3(a[9]);
|
||||||
ensure (a[10], "good", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[10], "good", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[9], "hello world", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[9], "hello world", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
call_by_ref_3(a[10]);
|
call_by_ref_3(a[10]);
|
||||||
ensure (a[10], "hello world", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[10], "hello world", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[9], "hello world", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[9], "hello world", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[0][40], "bye", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[0][40], "bye", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
call_by_ref_3(a[0][40]);
|
call_by_ref_3(a[0][40]);
|
||||||
ensure (a[0][40], "hello world", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[0][40], "hello world", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (length(a[0]), 2, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (length(a[0]), 2, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
delete a[0][40];
|
delete a[0][40];
|
||||||
ensure (length(a[0]), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (length(a[0]), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[0][0], "farewell", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[0][0], "farewell", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[0][40], nil, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[0][40], nil, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
#hawk::splice (a[0], 40, 1, @SCRIPTNAME, @SCRIPTLINE);
|
#hawk::splice (a[0], 40, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
#ensure (length(a[0]), 40, @SCRIPTNAME, @SCRIPTLINE);
|
#tap_ensure (length(a[0]), 40, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -218,25 +218,25 @@ function main()
|
|||||||
@local a, i;
|
@local a, i;
|
||||||
|
|
||||||
a = hawk::array();
|
a = hawk::array();
|
||||||
ensure (length(a), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (length(a), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
for (i = 0; i < 10; i++) a[i*i]=i;
|
for (i = 0; i < 10; i++) a[i*i]=i;
|
||||||
ensure (length(a), 10, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (length(a), 10, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
delete a[0];
|
delete a[0];
|
||||||
ensure (length(a), 9, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (length(a), 9, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
delete a[81];
|
delete a[81];
|
||||||
ensure (length(a), 8, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (length(a), 8, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
delete a[36];
|
delete a[36];
|
||||||
ensure (length(a), 7, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (length(a), 7, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
for (i = 0; i < 10; i++) delete a[i*i];
|
for (i = 0; i < 10; i++) delete a[i*i];
|
||||||
ensure (length(a), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (length(a), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
delete a;
|
delete a;
|
||||||
ensure (length(a), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (length(a), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -244,71 +244,72 @@ function main()
|
|||||||
a = hawk::array();
|
a = hawk::array();
|
||||||
a[10][20][30] = 20;
|
a[10][20][30] = 20;
|
||||||
b[12][20][30] = 20;
|
b[12][20][30] = 20;
|
||||||
ensure ((10 in a) && (20 in a[10]) && (30 in a[10][20]), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((10 in a) && (20 in a[10]) && (30 in a[10][20]), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((11 in a) && (20 in a[10]) && (30 in a[10][20]), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((11 in a) && (20 in a[10]) && (30 in a[10][20]), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
b = hawk::map();
|
b = hawk::map();
|
||||||
b[10][20][30] = 20;
|
b[10][20][30] = 20;
|
||||||
b[12][20][30] = 20;
|
b[12][20][30] = 20;
|
||||||
ensure ((10 in a) && (20 in a[10]) && (30 in a[10][20]), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((10 in a) && (20 in a[10]) && (30 in a[10][20]), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((11 in a) && (20 in a[10]) && (30 in a[10][20]), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((11 in a) && (20 in a[10]) && (30 in a[10][20]), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
c = hawk::map();
|
c = hawk::map();
|
||||||
c[10,20,30] = "heloo";
|
c[10,20,30] = "heloo";
|
||||||
ensure (((10,20,30) in c), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (((10,20,30) in c), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (((10,30,30) in c), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (((10,30,30) in c), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@local a;
|
@local a;
|
||||||
a = hawk::array(1,2,3);
|
a = hawk::array(1,2,3);
|
||||||
ensure (a[1], 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1], 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[2], 2, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[2], 2, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[3], 3, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[3], 3, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (length(a), 3, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (length(a), 3, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (hawk::typename(a), "array", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::typename(a), "array", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
# concatenation operator
|
# concatenation operator
|
||||||
ensure ((@b"hawk" 10) === @b"hawk10", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b"hawk" 10) === @b"hawk10", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (("hawk" 10) === "hawk10", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("hawk" 10) === "hawk10", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((@b"hawk" "hawk") === @b"hawkhawk", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b"hawk" "hawk") === @b"hawkhawk", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (("hawk" @b"hawk") === "hawkhawk", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("hawk" @b"hawk") === "hawkhawk", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((@b"hawk" '1') === @b"hawk1", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b"hawk" '1') === @b"hawk1", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (("hawk" '1') === "hawk1", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("hawk" '1') === "hawk1", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (('*' @b"hawk" '1') === "*hawk1", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (('*' @b"hawk" '1') === "*hawk1", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (('*' "hawk" '1') === "*hawk1", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (('*' "hawk" '1') === "*hawk1", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((@b"hawk" '⚾') === @b"hawk\xe2\x9a\xbe", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b"hawk" '⚾') === @b"hawk\xe2\x9a\xbe", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (("hawk" '⚾') === "hawk⚾", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("hawk" '⚾') === "hawk⚾", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((@b"hawk" str::fromcharcode(0x26be)) === @b"hawk\xe2\x9a\xbe", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b"hawk" str::fromcharcode(0x26be)) === @b"hawk\xe2\x9a\xbe", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (("hawk" str::fromcharcode(0x26be)) === "hawk⚾", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("hawk" str::fromcharcode(0x26be)) === "hawk⚾", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((@b"hawk" @b'\xFF') === @b"hawk\xFF", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b"hawk" @b'\xFF') === @b"hawk\xFF", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((str::subchar(@b"\xFF\xFE", 1) str::subchar(@b"\xFF\xFE", 2)) === @b"\xFF\xFE", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((str::subchar(@b"\xFF\xFE", 1) str::subchar(@b"\xFF\xFE", 2)) === @b"\xFF\xFE", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((@b"hawk" %% 10) === @b"hawk10", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b"hawk" %% 10) === @b"hawk10", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (("hawk" %% 10) === "hawk10", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("hawk" %% 10) === "hawk10", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((@b"hawk" %% "hawk") === @b"hawkhawk", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b"hawk" %% "hawk") === @b"hawkhawk", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (("hawk" %% @b"hawk") === "hawkhawk", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("hawk" %% @b"hawk") === "hawkhawk", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((@b"hawk" %% '1') === @b"hawk1", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b"hawk" %% '1') === @b"hawk1", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (("hawk" %% '1') === "hawk1", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("hawk" %% '1') === "hawk1", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (('*' %% @b"hawk" %% '1') === "*hawk1", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (('*' %% @b"hawk" %% '1') === "*hawk1", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (('*' %% "hawk" %% '1') === "*hawk1", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (('*' %% "hawk" %% '1') === "*hawk1", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((@b"hawk" %% '⚾') === @b"hawk\xe2\x9a\xbe", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b"hawk" %% '⚾') === @b"hawk\xe2\x9a\xbe", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (("hawk" %% '⚾') === "hawk⚾", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("hawk" %% '⚾') === "hawk⚾", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure ((@b"hawk" %% str::fromcharcode(0x26be)) === @b"hawk\xe2\x9a\xbe", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((@b"hawk" %% str::fromcharcode(0x26be)) === @b"hawk\xe2\x9a\xbe", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (("hawk" %% str::fromcharcode(0x26be)) === "hawk⚾", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("hawk" %% str::fromcharcode(0x26be)) === "hawk⚾", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
print "SUCCESS"
|
|
||||||
|
tap_end ();
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
@pragma entry main
|
@pragma entry main
|
||||||
@pragma implicit off
|
@pragma implicit off
|
||||||
|
|
||||||
@include "ensure.inc";
|
@include "tap.inc";
|
||||||
|
|
||||||
function main()
|
function main()
|
||||||
{
|
{
|
||||||
@ -14,14 +14,14 @@ function main()
|
|||||||
test2(foo2);
|
test2(foo2);
|
||||||
test3(foo3);
|
test3(foo3);
|
||||||
test4(foo4);
|
test4(foo4);
|
||||||
ensure (hawk::typename(foo1), "map", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::typename(foo1), "map", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (hawk::typename(foo2), "map", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::typename(foo2), "map", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (hawk::typename(foo3), "nil", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::typename(foo3), "nil", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (hawk::typename(foo4), "nil", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::typename(foo4), "nil", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (foo1[1], 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (foo1[1], 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (foo2[1], 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (foo2[1], 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (foo3[1], ini, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (foo3[1], ini, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (foo4[1], ini, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (foo4[1], ini, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
## gsub
|
## gsub
|
||||||
@ -30,68 +30,68 @@ function main()
|
|||||||
x = y = "x\\y";
|
x = y = "x\\y";
|
||||||
gsub(/\\\\/, "A", x);
|
gsub(/\\\\/, "A", x);
|
||||||
gsub("\\\\", "A", y);
|
gsub("\\\\", "A", y);
|
||||||
ensure (x, "x\\y", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x, "x\\y", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y, "xAy", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (y, "xAy", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
x = y = "x\\y";
|
x = y = "x\\y";
|
||||||
gsub(/\\\\/, 'A', x);
|
gsub(/\\\\/, 'A', x);
|
||||||
gsub("\\\\", 'A', y);
|
gsub("\\\\", 'A', y);
|
||||||
ensure (x, "x\\y", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x, "x\\y", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y, "xAy", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (y, "xAy", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
x = y = "x\\\\y";
|
x = y = "x\\\\y";
|
||||||
gsub(/\\\\/, "A", x);
|
gsub(/\\\\/, "A", x);
|
||||||
gsub("\\\\", "A", y);
|
gsub("\\\\", "A", y);
|
||||||
ensure (x, "xAy", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x, "xAy", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y, "xAAy", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (y, "xAAy", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
|
|
||||||
x = y = @b"x\\\\y";
|
x = y = @b"x\\\\y";
|
||||||
gsub(/\\\\/, "A", x);
|
gsub(/\\\\/, "A", x);
|
||||||
gsub("\\\\", "A", y);
|
gsub("\\\\", "A", y);
|
||||||
ensure (x === @b"xAy", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x === @b"xAy", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y === @b"xAAy", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (y === @b"xAAy", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
x = y = @b"x\\\\y";
|
x = y = @b"x\\\\y";
|
||||||
gsub(/\\\\/, 'A', x);
|
gsub(/\\\\/, 'A', x);
|
||||||
gsub("\\\\", 'A', y);
|
gsub("\\\\", 'A', y);
|
||||||
ensure (x === @b"xAy", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x === @b"xAy", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y === @b"xAAy", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (y === @b"xAAy", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
x = y = "x\\\\y";
|
x = y = "x\\\\y";
|
||||||
gsub(/\\\\/, @b'A', x);
|
gsub(/\\\\/, @b'A', x);
|
||||||
gsub("\\\\", @b'A', y);
|
gsub("\\\\", @b'A', y);
|
||||||
ensure (x === "xAy", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x === "xAy", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y === "xAAy", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (y === "xAAy", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
x = y = "x\\\\y";
|
x = y = "x\\\\y";
|
||||||
gsub(/\\\\/, @b"A", x);
|
gsub(/\\\\/, @b"A", x);
|
||||||
gsub("\\\\", @b"A", y);
|
gsub("\\\\", @b"A", y);
|
||||||
ensure (x === "xAy", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x === "xAy", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y === "xAAy", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (y === "xAAy", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
x = y = '\\';
|
x = y = '\\';
|
||||||
gsub(/\\/, @b"A", x);
|
gsub(/\\/, @b"A", x);
|
||||||
gsub("\\\\", @b"A", y);
|
gsub("\\\\", @b"A", y);
|
||||||
ensure (x === "A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x === "A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y === "A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (y === "A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
x = y = '\\';
|
x = y = '\\';
|
||||||
gsub(/\\/, @b'A', x);
|
gsub(/\\/, @b'A', x);
|
||||||
gsub("\\\\", @b'A', y);
|
gsub("\\\\", @b'A', y);
|
||||||
ensure (x === "A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x === "A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
x = y = @b'\\';
|
x = y = @b'\\';
|
||||||
gsub(/\\/, @b"A", x);
|
gsub(/\\/, @b"A", x);
|
||||||
gsub("\\\\", @b"A", y);
|
gsub("\\\\", @b"A", y);
|
||||||
ensure (x === @b"A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x === @b"A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y === @b"A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (y === @b"A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
x = y = @b'\\';
|
x = y = @b'\\';
|
||||||
gsub(/\\/, @b'A', x);
|
gsub(/\\/, @b'A', x);
|
||||||
gsub("\\\\", @b'A', y);
|
gsub("\\\\", @b'A', y);
|
||||||
ensure (x === @b"A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x === @b"A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y === @b"A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (y === @b"A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
## gsub - POSIX rule for &, \&, \\&, \\\&
|
## gsub - POSIX rule for &, \&, \\&, \\\&
|
||||||
@ -107,12 +107,12 @@ function main()
|
|||||||
gsub(/a/, "\\\\\&", z1); # gsub sees \\&
|
gsub(/a/, "\\\\\&", z1); # gsub sees \\&
|
||||||
gsub(/a/, "\\\\\\&", z2); # gsub sees \\\&
|
gsub(/a/, "\\\\\\&", z2); # gsub sees \\\&
|
||||||
|
|
||||||
ensure (w, "xax", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (w, "xax", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (x, "x&x", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x, "x&x", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y, "x&x", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (y, "x&x", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (z, "x\\ax", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (z, "x\\ax", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (z1, "x\\ax", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (z1, "x\\ax", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (z2, "x\\&x", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (z2, "x\\&x", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
w = x = y = z = z1 = z2 = "xaax";
|
w = x = y = z = z1 = z2 = "xaax";
|
||||||
|
|
||||||
@ -124,12 +124,12 @@ function main()
|
|||||||
gsub(/a/, "\\\\\&", z1); # gsub sees \\&
|
gsub(/a/, "\\\\\&", z1); # gsub sees \\&
|
||||||
gsub(/a/, "\\\\\\&", z2); # gsub sees \\\&
|
gsub(/a/, "\\\\\\&", z2); # gsub sees \\\&
|
||||||
|
|
||||||
ensure (w, "xaax", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (w, "xaax", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (x, "x&&x", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x, "x&&x", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y, "x&&x", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (y, "x&&x", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (z, "x\\a\\ax", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (z, "x\\a\\ax", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (z1, "x\\a\\ax", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (z1, "x\\a\\ax", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (z2, "x\\&\\&x", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (z2, "x\\&\\&x", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
## gsub - POSIX rule for &, \&, \\&, \\\& - express the same test with a raw string literal
|
## gsub - POSIX rule for &, \&, \\&, \\\& - express the same test with a raw string literal
|
||||||
@ -143,10 +143,10 @@ function main()
|
|||||||
gsub(/a/, @r"\\&", y); # gsub sees \\&
|
gsub(/a/, @r"\\&", y); # gsub sees \\&
|
||||||
gsub(/a/, @r"\\\&", z); # gsub sees \\\&
|
gsub(/a/, @r"\\\&", z); # gsub sees \\\&
|
||||||
|
|
||||||
ensure (w, "xax", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (w, "xax", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (x, "x&x", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x, "x&x", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y, @r"x\ax", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (y, @r"x\ax", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (z, @r"x\&x", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (z, @r"x\&x", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
w = x = y = z = "xaax";
|
w = x = y = z = "xaax";
|
||||||
|
|
||||||
@ -156,10 +156,10 @@ function main()
|
|||||||
gsub(/a/, @r"\\&", y); # gsub sees \\&
|
gsub(/a/, @r"\\&", y); # gsub sees \\&
|
||||||
gsub(/a/, @r"\\\&", z); # gsub sees \\\&
|
gsub(/a/, @r"\\\&", z); # gsub sees \\\&
|
||||||
|
|
||||||
ensure (w, "xaax", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (w, "xaax", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (x, "x&&x", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x, "x&&x", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y, @r"x\a\ax", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (y, @r"x\a\ax", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (z, @r"x\&\&x", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (z, @r"x\&\&x", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
## sub - POSIX rule for &, \&, \\&, \\\& - express the same test with a raw string literal
|
## sub - POSIX rule for &, \&, \\&, \\\& - express the same test with a raw string literal
|
||||||
@ -173,10 +173,10 @@ function main()
|
|||||||
sub(/a/, @r"\\&", y);
|
sub(/a/, @r"\\&", y);
|
||||||
sub(/a/, @r"\\\&", z);
|
sub(/a/, @r"\\\&", z);
|
||||||
|
|
||||||
ensure (w, "xax", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (w, "xax", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (x, "x&x", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x, "x&x", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y, @r"x\ax", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (y, @r"x\ax", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (z, @r"x\&x", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (z, @r"x\&x", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
w = x = y = z = "xaax";
|
w = x = y = z = "xaax";
|
||||||
|
|
||||||
@ -186,10 +186,10 @@ function main()
|
|||||||
sub(/a/, @r"\\&", y);
|
sub(/a/, @r"\\&", y);
|
||||||
sub(/a/, @r"\\\&", z);
|
sub(/a/, @r"\\\&", z);
|
||||||
|
|
||||||
ensure (w, "xaax", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (w, "xaax", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (x, "x&ax", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (x, "x&ax", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (y, @r"x\aax", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (y, @r"x\aax", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (z, @r"x\&ax", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (z, @r"x\&ax", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -198,388 +198,388 @@ function main()
|
|||||||
|
|
||||||
pi = 3.1415927;
|
pi = 3.1415927;
|
||||||
|
|
||||||
ensure (sprintf("%.10d:%.10x", 5, 14), "0000000005:000000000e", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%.10d:%.10x", 5, 14), "0000000005:000000000e", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (sprintf("cos(%f) = %f", pi/4, cos(pi/4)), "cos(0.785398) = 0.707107", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("cos(%f) = %f", pi/4, cos(pi/4)), "cos(0.785398) = 0.707107", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("sin(%f) = %f", pi/4, sin(pi/4)), "sin(0.785398) = 0.707107", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("sin(%f) = %f", pi/4, sin(pi/4)), "sin(0.785398) = 0.707107", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
e = exp(1);
|
e = exp(1);
|
||||||
ensure (sprintf("e = %f", e), "e = 2.718282", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("e = %f", e), "e = 2.718282", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("log(e) = %f", log(e)), "log(e) = 1.000000", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("log(e) = %f", log(e)), "log(e) = 1.000000", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("sqrt(pi ^ 2) = %f", sqrt(pi ^ 2)), "sqrt(pi ^ 2) = 3.141593", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("sqrt(pi ^ 2) = %f", sqrt(pi ^ 2)), "sqrt(pi ^ 2) = 3.141593", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("atan2(1, 1) = %f", atan2(1, 1)), "atan2(1, 1) = 0.785398", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("atan2(1, 1) = %f", atan2(1, 1)), "atan2(1, 1) = 0.785398", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
tmp = sprintf("%s", "hello");
|
tmp = sprintf("%s", "hello");
|
||||||
ensure ((tmp === @b"hello"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((tmp === @b"hello"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((tmp === "hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((tmp === "hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((tmp == @b"hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((tmp == @b"hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((tmp == "hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((tmp == "hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
tmp = sprintf("%s", @b"hello");
|
tmp = sprintf("%s", @b"hello");
|
||||||
ensure ((tmp === @b"hello"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((tmp === @b"hello"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((tmp === "hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((tmp === "hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((tmp == @b"hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((tmp == @b"hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((tmp == "hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((tmp == "hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
tmp = sprintf(@b"%s", "hello");
|
tmp = sprintf(@b"%s", "hello");
|
||||||
ensure ((tmp === @b"hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((tmp === @b"hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((tmp === "hello"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((tmp === "hello"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((tmp == @b"hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((tmp == @b"hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((tmp == "hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((tmp == "hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
tmp = sprintf(@b"%s", @b"hello");
|
tmp = sprintf(@b"%s", @b"hello");
|
||||||
ensure ((tmp === @b"hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((tmp === @b"hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((tmp === "hello"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((tmp === "hello"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((tmp == @b"hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((tmp == @b"hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure ((tmp == "hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure ((tmp == "hello"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (sprintf("%0d", 0), "0", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%0d", 0), "0", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%0.d", 0), "", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%0.d", 0), "", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%.d", 0), "", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%.d", 0), "", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%.*d", 0, 0), "", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%.*d", 0, 0), "", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%.*d", 1, 0), "0", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%.*d", 1, 0), "0", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%*d", 0, 0), "0", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%*d", 0, 0), "0", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%*.*d", 0, 0, 0), "", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%*.*d", 0, 0, 0), "", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%-*.*d", 0, 0, 0), "", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%-*.*d", 0, 0, 0), "", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%*.*d", 1, 0, 0), " ", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%*.*d", 1, 0, 0), " ", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%*.*d", 0, 3, 0), "000", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%*.*d", 0, 3, 0), "000", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%-*d", 0, 0), "0", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%-*d", 0, 0), "0", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (sprintf(@b"%0d", 0), @b"0", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%0d", 0), @b"0", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%0.d", 0), @b"", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%0.d", 0), @b"", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%.d", 0), @b"", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%.d", 0), @b"", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%.*d", 0, 0), @b"", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%.*d", 0, 0), @b"", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%.*d", 1, 0), @b"0", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%.*d", 1, 0), @b"0", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%*d", 0, 0), @b"0", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%*d", 0, 0), @b"0", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%*.*d", 0, 0, 0), @b"", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%*.*d", 0, 0, 0), @b"", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%-*.*d", 0, 0, 0), @b"", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%-*.*d", 0, 0, 0), @b"", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%*.*d", 1, 0, 0), @b" ", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%*.*d", 1, 0, 0), @b" ", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%*.*d", 0, 3, 0), @b"000", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%*.*d", 0, 3, 0), @b"000", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%-*d", 0, 0), @b"0", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%-*d", 0, 0), @b"0", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (sprintf("%5d", 5), " 5", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%5d", 5), " 5", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%-5d", 5), "5 ", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%-5d", 5), "5 ", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%*d", 5, 5), " 5", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%*d", 5, 5), " 5", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%*d", -5, 5), "5 ", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%*d", -5, 5), "5 ", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%-*d", 5, 5), "5 ", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%-*d", 5, 5), "5 ", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%-*d", -5, 5), "5 ", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%-*d", -5, 5), "5 ", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (sprintf(@b"%5d", 5), @b" 5", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%5d", 5), @b" 5", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%-5d", 5), @b"5 ", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%-5d", 5), @b"5 ", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%*d", 5, 5), @b" 5", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%*d", 5, 5), @b" 5", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%*d", -5, 5), @b"5 ", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%*d", -5, 5), @b"5 ", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%-*d", 5, 5), @b"5 ", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%-*d", 5, 5), @b"5 ", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (sprintf("%*sworld", 20, "hello"), " helloworld", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%*sworld", 20, "hello"), " helloworld", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%*sworld", -20, "hello"), "hello world", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%*sworld", -20, "hello"), "hello world", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%-*sworld", 20, "hello"), "hello world", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%-*sworld", 20, "hello"), "hello world", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%-*sworld", -20, "hello"), "hello world", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%-*sworld", -20, "hello"), "hello world", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (sprintf(@b"%*sworld", 20, "hello"), @b" helloworld", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%*sworld", 20, "hello"), @b" helloworld", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%*sworld", -20, "hello"), @b"hello world", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%*sworld", -20, "hello"), @b"hello world", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%-*sworld", 20, "hello"), @b"hello world", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%-*sworld", 20, "hello"), @b"hello world", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%-*sworld", -20, "hello"), @b"hello world", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%-*sworld", -20, "hello"), @b"hello world", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (sprintf("%0s", "hello"), "hello", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%0s", "hello"), "hello", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%.0s", "hello"), "", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%.0s", "hello"), "", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%0.0s", "hello"), "", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%0.0s", "hello"), "", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%1.0s", "hello"), " ", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%1.0s", "hello"), " ", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%*.*s", 20, 0, "hello"), " ", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%*.*s", 20, 0, "hello"), " ", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf("%*.*s", 20, 2, "hello"), " he", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%*.*s", 20, 2, "hello"), " he", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (sprintf(@b"%0s", "hello"), @b"hello", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%0s", "hello"), @b"hello", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%.0s", "hello"), @b"", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%.0s", "hello"), @b"", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%0.0s", "hello"), @b"", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%0.0s", "hello"), @b"", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%1.0s", "hello"), @b" ", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%1.0s", "hello"), @b" ", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%*.*s", 20, 0, "hello"), @b" ", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%*.*s", 20, 0, "hello"), @b" ", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%*.*s", 20, 2, "hello"), @b" he", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%*.*s", 20, 2, "hello"), @b" he", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (sprintf("%+d %d", 3, 4), "+3 4", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf("%+d %d", 3, 4), "+3 4", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf(@b"%+d %d", 3, 4), @b"+3 4", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b"%+d %d", 3, 4), @b"+3 4", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
|
|
||||||
ensure (sprintf(@b'A') === @b"A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf(@b'A') === @b"A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (sprintf('A') === "A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (sprintf('A') === "A", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@local bool, b, c;
|
@local bool, b, c;
|
||||||
|
|
||||||
ensure ((c === @nil), 1, @SCRIPTNAME, @SCRIPTLINE); ## ensure local variable initialization
|
tap_ensure ((c === @nil), 1, @SCRIPTNAME, @SCRIPTLINE); ## tap_ensure local variable initialization
|
||||||
|
|
||||||
bool = ((b = 1) in c);
|
bool = ((b = 1) in c);
|
||||||
ensure (bool, 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (bool, 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (b, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (b, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
ensure (substr(1000+"5000", 2) === "000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (substr(1000+"5000", 2) === "000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (substr(1000+"10000", 2) === "1000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (substr(1000+"10000", 2) === "1000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (substr(1000+"5000", 2) === "000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (substr(1000+"5000", 2) === "000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (substr("5000" + 1000, 2) === "000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (substr("5000" + 1000, 2) === "000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (substr("10000" + 1000, 2) === "1000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (substr("10000" + 1000, 2) === "1000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (substr("5000" + 1000, 2) === "000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (substr("5000" + 1000, 2) === "000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (substr(@b"5000" + 1000, 2) === "000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (substr(@b"5000" + 1000, 2) === "000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (substr(@b"10000" + 1000, 2) === "1000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (substr(@b"10000" + 1000, 2) === "1000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (substr(@b"5000" + 1000, 2) === "000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (substr(@b"5000" + 1000, 2) === "000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (substr(@b"5000", 2) === @b"000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (substr(@b"5000", 2) === @b"000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (substr(@b"10000", 2) === @b"0000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (substr(@b"10000", 2) === @b"0000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (substr(@b"5000", 2) === @b"000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (substr(@b"5000", 2) === @b"000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (substr(1000+5000, 2) === "000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (substr(1000+5000, 2) === "000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (substr(1000+10000, 2) === "1000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (substr(1000+10000, 2) === "1000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (substr(1000+5000, 2) === "000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (substr(1000+5000, 2) === "000", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::subchar("abc", -1) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar("abc", -1) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar("abc", 0) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar("abc", 0) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar("abc", 1) === 'a', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar("abc", 1) === 'a', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar("abc", 2) === 'b', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar("abc", 2) === 'b', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar("abc", 3) === 'c', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar("abc", 3) === 'c', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar("abc", 4) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar("abc", 4) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::subchar("☕⛄", -1) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar("☕⛄", -1) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar("☕⛄", 0) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar("☕⛄", 0) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar("☕⛄", 1) === '☕', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar("☕⛄", 1) === '☕', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar("☕⛄", 2) === '⛄', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar("☕⛄", 2) === '⛄', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar("☕⛄", 3) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar("☕⛄", 3) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar("☕⛄", 4) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar("☕⛄", 4) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::subchar(@b"abc", -1) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar(@b"abc", -1) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar(@b"abc", 0) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar(@b"abc", 0) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar(@b"abc", 1) === @b'a', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar(@b"abc", 1) === @b'a', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar(@b"abc", 2) === @b'b', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar(@b"abc", 2) === @b'b', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar(@b"abc", 3) === @b'c', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar(@b"abc", 3) === @b'c', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar(@b"abc", 4) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar(@b"abc", 4) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::subchar('a', 0) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar('a', 0) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar('a', 1) === 'a', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar('a', 1) === 'a', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar('a', 2) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar('a', 2) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::subchar(@b'a', 0) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar(@b'a', 0) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar(@b'a', 1) === @b'a', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar(@b'a', 1) === @b'a', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar(@b'a', 2) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar(@b'a', 2) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::subchar(123, 0) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar(123, 0) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar(123, 1) === '1', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar(123, 1) === '1', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar(123, 2) === '2', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar(123, 2) === '2', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar(123, 3) === '3', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar(123, 3) === '3', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::subchar(123, 4) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::subchar(123, 4) === @nil, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
ensure (str::substr("☕Q⛄", 0) === "☕Q⛄", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::substr("☕Q⛄", 0) === "☕Q⛄", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::substr("☕Q⛄", 1) === "☕Q⛄", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::substr("☕Q⛄", 1) === "☕Q⛄", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::substr("☕Q⛄", 2) === "Q⛄", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::substr("☕Q⛄", 2) === "Q⛄", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::substr("☕Q⛄", 3) === "⛄", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::substr("☕Q⛄", 3) === "⛄", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::substr("☕Q⛄", 4) === "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::substr("☕Q⛄", 4) === "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::substr("☕Q⛄", 1, 2) === "☕Q", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::substr("☕Q⛄", 1, 2) === "☕Q", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::substr("☕Q⛄", 1, 4) === "☕Q⛄", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::substr("☕Q⛄", 1, 4) === "☕Q⛄", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
###ensure (str::substr("☕Q⛄", -1, 1) === "⛄", 1, @SCRIPTNAME, @SCRIPTLINE); ## not supported yet
|
###tap_ensure (str::substr("☕Q⛄", -1, 1) === "⛄", 1, @SCRIPTNAME, @SCRIPTLINE); ## not supported yet
|
||||||
ensure (str::substr('☕', 1, 4) === "☕", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::substr('☕', 1, 4) === "☕", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::substr(@b"\xAD\xAA\xBB\CC", 2, 2) === @b"\xAA\xBB", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::substr(@b"\xAD\xAA\xBB\CC", 2, 2) === @b"\xAA\xBB", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::substr(@b'\xAD', 1, 1) === @b"\xAD", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::substr(@b'\xAD', 1, 1) === @b"\xAD", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
ensure (str::index("☕Q⛄X⛄Z", '⛄'), 3, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::index("☕Q⛄X⛄Z", '⛄'), 3, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::index("☕Q⛄X⛄Z", "⛄"), 3, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::index("☕Q⛄X⛄Z", "⛄"), 3, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::index("☕Q⛄X⛄Z", "Q⛄"), 2, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::index("☕Q⛄X⛄Z", "Q⛄"), 2, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::rindex("☕Q⛄X⛄Z", '⛄'), 5, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::rindex("☕Q⛄X⛄Z", '⛄'), 5, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::rindex("☕Q⛄X⛄Z", "⛄"), 5, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::rindex("☕Q⛄X⛄Z", "⛄"), 5, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::rindex("☕Q⛄X⛄Z", "Q⛄"), 2, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::rindex("☕Q⛄X⛄Z", "Q⛄"), 2, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::rindex("☕Q⛄X⛄Z", "Q⛄Q"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::rindex("☕Q⛄X⛄Z", "Q⛄Q"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::index(@b"\xFFQ\xABX\xABZ", @b'\xAB'), 3, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::index(@b"\xFFQ\xABX\xABZ", @b'\xAB'), 3, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::index(@b"\xFFQ\xABX\xABZ", @b"\xAB"), 3, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::index(@b"\xFFQ\xABX\xABZ", @b"\xAB"), 3, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::index(@b"\xFFQ\xABX\xABZ", @b"Q\xAB"), 2, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::index(@b"\xFFQ\xABX\xABZ", @b"Q\xAB"), 2, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::rindex(@b"\xFFQ\xABX\xABZ", @b'\xAB'), 5, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::rindex(@b"\xFFQ\xABX\xABZ", @b'\xAB'), 5, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::rindex(@b"\xFFQ\xABX\xABZ", @b"\xAB"), 5, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::rindex(@b"\xFFQ\xABX\xABZ", @b"\xAB"), 5, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::rindex(@b"\xFFQ\xABX\xABZ", @b"Q\xAB"), 2, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::rindex(@b"\xFFQ\xABX\xABZ", @b"Q\xAB"), 2, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::rindex(@b"\xFFQ\xABX\xABZ", @b"Q\xABQ"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::rindex(@b"\xFFQ\xABX\xABZ", @b"Q\xABQ"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
# split, str::split, str::splita
|
# split, str::split, str::splita
|
||||||
@local a, str;
|
@local a, str;
|
||||||
|
|
||||||
ensure (split("Here===Is=Some=====Data", a, "=+"), 4, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (split("Here===Is=Some=====Data", a, "=+"), 4, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[1] === "Here", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1] === "Here", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[2] === "Is", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[2] === "Is", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[3] === "Some", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[3] === "Some", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[4] === "Data", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[4] === "Data", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (split(@b"Here===Is=Some=====Data", a, @b"=+"), 4, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (split(@b"Here===Is=Some=====Data", a, @b"=+"), 4, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[1] === @b"Here", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1] === @b"Here", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[2] === @b"Is", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[2] === @b"Is", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[3] === @b"Some", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[3] === @b"Some", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[4] === @b"Data", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[4] === @b"Data", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (split(@b"Here===Is=Some=====Data", a, /=+/), 4, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (split(@b"Here===Is=Some=====Data", a, /=+/), 4, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[1] === @b"Here", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1] === @b"Here", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[2] === @b"Is", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[2] === @b"Is", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[3] === @b"Some", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[3] === @b"Some", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[4] === @b"Data", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[4] === @b"Data", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (split("[Here] : [Is] : [So\\]me] :[Da:ta]", a, "?:\\[]"), 4, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (split("[Here] : [Is] : [So\\]me] :[Da:ta]", a, "?:\\[]"), 4, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[1] === "Here", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1] === "Here", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[2] === "Is", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[2] === "Is", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[3] === "So]me", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[3] === "So]me", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[4] === "Da:ta", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[4] === "Da:ta", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (split(@b"[Here] : [Is] : [So\\]me] :[Da:ta]", a, "?:\\[]"), 4, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (split(@b"[Here] : [Is] : [So\\]me] :[Da:ta]", a, "?:\\[]"), 4, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[1] === @b"Here", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1] === @b"Here", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[2] === @b"Is", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[2] === @b"Is", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[3] === @b"So]me", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[3] === @b"So]me", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[4] === @b"Da:ta", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[4] === @b"Da:ta", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (split("Here===Is=Some=====Data", a, ""), 23, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (split("Here===Is=Some=====Data", a, ""), 23, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (hawk::typename(a), "map", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::typename(a), "map", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::splita("Here===Is=Some=====Data", a, ""), 23, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::splita("Here===Is=Some=====Data", a, ""), 23, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (hawk::typename(a), "array",@SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::typename(a), "array",@SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::split("Here Is Some Data", a, / /), 7, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::split("Here Is Some Data", a, / /), 7, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::split("Here Is Some Data", a, " "), 4, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::split("Here Is Some Data", a, " "), 4, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[1] === "Here", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1] === "Here", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[2] === "Is", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[2] === "Is", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[3] === "Some", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[3] === "Some", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[4] === "Data", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[4] === "Data", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
str = "a b\t\tc d";
|
str = "a b\t\tc d";
|
||||||
ensure (str::splita(str, a, " "), 4, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::splita(str, a, " "), 4, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[1], "a", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1], "a", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[2], "b", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[2], "b", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[3], "c", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[3], "c", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[4], "d", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[4], "d", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::splita(str, a, / /), 5, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::splita(str, a, / /), 5, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[1], "a", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1], "a", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[2], "", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[2], "", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[3], "", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[3], "", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[4], "b\t\tc", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[4], "b\t\tc", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[5], "d", @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[5], "d", @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::split('a', a, /a/), 2, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::split('a', a, /a/), 2, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[1] === "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1] === "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[2] === "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[2] === "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::split('a', a, 'a'), 2, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::split('a', a, 'a'), 2, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[1] === "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1] === "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[2] === "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[2] === "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::split('a', a, @b'a'), 2, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::split('a', a, @b'a'), 2, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[1] === "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1] === "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[2] === "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[2] === "", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::split(@b'a', a, /a/), 2, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::split(@b'a', a, /a/), 2, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[1] === @b"", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1] === @b"", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[2] === @b"", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[2] === @b"", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::split(@b'a', a, @b'a'), 2, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::split(@b'a', a, @b'a'), 2, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[1] === @b"", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[1] === @b"", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (a[2] === @b"", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a[2] === @b"", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
## back reference in a regular expression
|
## back reference in a regular expression
|
||||||
ensure (("a2b" ~ /(a)\12b/), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("a2b" ~ /(a)\12b/), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (("aa2b" ~ /(a)\12b/), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("aa2b" ~ /(a)\12b/), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (("aaa2b" ~ /(a)\12b/), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (("aaa2b" ~ /(a)\12b/), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
## character class functions in the str modules
|
## character class functions in the str modules
|
||||||
ensure (str::isalnum('a'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isalnum('a'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::isalpha('a'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isalpha('a'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::isblank('a'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isblank('a'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::iscntrl('a'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::iscntrl('a'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::isdigit('a'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isdigit('a'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::isgraph('a'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isgraph('a'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::islower('a'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::islower('a'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::isprint('a'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isprint('a'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::ispunct('a'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::ispunct('a'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::isspace('a'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isspace('a'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::isupper('a'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isupper('a'), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::isxdigit('a'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isxdigit('a'), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::toupper('a') === 'A', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::toupper('a') === 'A', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::tolower('A') === 'a', 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::tolower('A') === 'a', 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::isalnum("a"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isalnum("a"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::isalpha("a"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isalpha("a"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::isblank("a"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isblank("a"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::iscntrl("a"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::iscntrl("a"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::isdigit("a"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isdigit("a"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::isgraph("a"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isgraph("a"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::islower("a"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::islower("a"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::isprint("a"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isprint("a"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::ispunct("a"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::ispunct("a"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::isspace("a"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isspace("a"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::isupper("a"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isupper("a"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::isxdigit("a"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::isxdigit("a"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::toupper("abc") === "ABC", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::toupper("abc") === "ABC", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::tolower("ABC") === "abc", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::tolower("ABC") === "abc", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::toupper(@b"abc") === @b"ABC", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::toupper(@b"abc") === @b"ABC", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::tolower(@b"ABC") === @b"abc", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::tolower(@b"ABC") === @b"abc", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
ensure (str::tocharcode(@b'\xFF'), 0xFF, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::tocharcode(@b'\xFF'), 0xFF, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::tocharcode('\u3321'), 0x3321, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::tocharcode('\u3321'), 0x3321, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::tocharcode(@b'\xFF', 0), @nil, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::tocharcode(@b'\xFF', 0), @nil, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::tocharcode('\u3321', 0), @nil, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::tocharcode('\u3321', 0), @nil, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::tocharcode(@b'\xFF', 1), 0xFF, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::tocharcode(@b'\xFF', 1), 0xFF, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::tocharcode('\u3321', 1), 0x3321, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::tocharcode('\u3321', 1), 0x3321, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::tocharcode(@b'\xFF', 2), @nil, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::tocharcode(@b'\xFF', 2), @nil, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::tocharcode('\u3321', 2), @nil, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::tocharcode('\u3321', 2), @nil, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::tocharcode(str::fromcharcode('2')), 2, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::tocharcode(str::fromcharcode('2')), 2, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::tonum('a', 16), 10, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::tonum('a', 16), 10, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::fromcharcode(65, 66, 67) === "ABC", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::fromcharcode(65, 66, 67) === "ABC", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::frombcharcode(65, 66, 67) === @b"ABC", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::frombcharcode(65, 66, 67) === @b"ABC", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
ensure (str::trim(" hello world ") === "hello world", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::trim(" hello world ") === "hello world", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::trim(" hello world ", str::TRIM_PAC_SPACES) === "hello world", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::trim(" hello world ", str::TRIM_PAC_SPACES) === "hello world", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::trim(@b" hello world ") === @b"hello world", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::trim(@b" hello world ") === @b"hello world", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (str::trim(@b" hello world ", str::TRIM_PAC_SPACES) === @b"hello world", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (str::trim(@b" hello world ", str::TRIM_PAC_SPACES) === @b"hello world", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
@local a, b, c, d;
|
@local a, b, c, d;
|
||||||
sys::pack(a, ">hhl", 1, 2, 3);
|
sys::pack(a, ">hhl", 1, 2, 3);
|
||||||
ensure (a === @b"\x00\x01\x00\x02\x00\x00\x00\x00\x00\x00\x00\x03", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a === @b"\x00\x01\x00\x02\x00\x00\x00\x00\x00\x00\x00\x03", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
sys::pack(a, ">ci", @b'*', 0x12131415);
|
sys::pack(a, ">ci", @b'*', 0x12131415);
|
||||||
ensure (a === @b"*\x12\x13\x14\x15", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a === @b"*\x12\x13\x14\x15", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
sys::pack(a, ">ic", 0x12131415, @b"*+-");
|
sys::pack(a, ">ic", 0x12131415, @b"*+-");
|
||||||
ensure (a === @b"\x12\x13\x14\x15*", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a === @b"\x12\x13\x14\x15*", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
sys::pack(a, "3c", @b"*+-", 't', "pack");
|
sys::pack(a, "3c", @b"*+-", 't', "pack");
|
||||||
ensure (a === @b"*tp", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a === @b"*tp", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
sys::unpack (@b"raymond \x32\x12\x08\x01\x08", "<10sHHb", a, b, c, d);
|
sys::unpack (@b"raymond \x32\x12\x08\x01\x08", "<10sHHb", a, b, c, d);
|
||||||
ensure (a === @b"raymond ", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a === @b"raymond ", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (b === 4658, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (b === 4658, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (c === 264, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (c === 264, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (d === 8, 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (d === 8, 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
sys::unpack (@b"raymond", "3c", a, b, c);
|
sys::unpack (@b"raymond", "3c", a, b, c);
|
||||||
ensure (a === @b'r' , 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (a === @b'r' , 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (b === @b'a' , 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (b === @b'a' , 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
ensure (c === @b'y' , 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (c === @b'y' , 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
print "SUCCESS";
|
tap_end ();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test1(&foo) { test2(foo) }
|
function test1(&foo) { test2(foo) }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
@pragma entry main
|
@pragma entry main
|
||||||
@pragma implicit off
|
@pragma implicit off
|
||||||
|
|
||||||
@include "ensure.inc";
|
@include "tap.inc";
|
||||||
|
|
||||||
function are_files_identical(a, b)
|
function are_files_identical(a, b)
|
||||||
{
|
{
|
||||||
@ -59,8 +59,11 @@ function run_test (x, more_opts, in_name, out_name)
|
|||||||
if (same <= 0)
|
if (same <= 0)
|
||||||
{
|
{
|
||||||
## don't delete the output file for review.
|
## don't delete the output file for review.
|
||||||
printf ("FAILURE: %s - %s and %s differ\n", x, expf, outf);
|
tap_fail (sprintf("%s[%d] %s - %s and %s differ", @SCRIPTNAME, @SCRIPTLINE, x, expf, outf));
|
||||||
exit (1);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tap_ok (sprintf("%s[%d]", @SCRIPTNAME, @SCRIPTLINE));
|
||||||
}
|
}
|
||||||
|
|
||||||
sys::unlink (outf);
|
sys::unlink (outf);
|
||||||
@ -71,6 +74,6 @@ function main()
|
|||||||
run_test ("journal-toc");
|
run_test ("journal-toc");
|
||||||
run_test ("journal-toc", "-vHTML=1", "journal-toc", "journal-toc-html");
|
run_test ("journal-toc", "-vHTML=1", "journal-toc", "journal-toc-html");
|
||||||
run_test ("bibtex-to-html", "", "journal-toc", "bibtex-to-html");
|
run_test ("bibtex-to-html", "", "journal-toc", "bibtex-to-html");
|
||||||
print "SUCCESS";
|
tap_end ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
@pragma entry main
|
@pragma entry main
|
||||||
@pragma implicit off
|
@pragma implicit off
|
||||||
|
|
||||||
@include "ensure.inc";
|
@include "tap.inc";
|
||||||
|
|
||||||
function run_test_001 ()
|
function run_test_001 ()
|
||||||
{
|
{
|
||||||
@ -11,13 +11,17 @@ function run_test_001 ()
|
|||||||
{
|
{
|
||||||
##tmp = sed::str_to_str("s/a/j/g", "aaabbbaaacccaaaddd", out);
|
##tmp = sed::str_to_str("s/a/j/g", "aaabbbaaacccaaaddd", out);
|
||||||
tmp = hawk::call("sed::str_to_str", "s/a/j/g", "aaabbbaaacccaaaddd", out);
|
tmp = hawk::call("sed::str_to_str", "s/a/j/g", "aaabbbaaacccaaaddd", out);
|
||||||
ensure (out === "jjjbbbjjjcccjjjddd", 1, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (out === "jjjbbbjjjcccjjjddd", 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tap_skip (sprintf("sed::str_top_str() is unavailable - %s[%d]", @SCRIPTNAME, @SCRIPTLINE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function main()
|
function main()
|
||||||
{
|
{
|
||||||
run_test_001 ();
|
run_test_001 ();
|
||||||
print "SUCCESS";
|
tap_end ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
38
hawk/t/tap.inc
Normal file
38
hawk/t/tap.inc
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
@global tap;
|
||||||
|
|
||||||
|
function tap_end ()
|
||||||
|
{
|
||||||
|
printf ("1..%d\n", tap["total"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function tap_ok (msg)
|
||||||
|
{
|
||||||
|
tap["total"]++;
|
||||||
|
printf ("ok %d - %s\n", tap["total"], msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
function tap_fail (msg)
|
||||||
|
{
|
||||||
|
tap["total"]++;
|
||||||
|
printf ("not ok %d - %s\n", tap["total"], msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
function tap_skip (msg)
|
||||||
|
{
|
||||||
|
tap["total"]++;
|
||||||
|
printf ("ok %d - # skip%s%s\n", tap["total"], (length(msg) > 0? " ": ""), msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function tap_ensure (a, b, desc, line)
|
||||||
|
{
|
||||||
|
@local id;
|
||||||
|
|
||||||
|
id = sprintf("%s[%d]", desc, line);
|
||||||
|
if (a != b) tap_fail (id);
|
||||||
|
else tap_ok (id);
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
tap["total"] = 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user