mirror of
https://github.com/brazilofmux/tinymux
synced 2026-08-13 00:23:11 -04:00
124 lines
3.2 KiB
Text
124 lines
3.2 KiB
Text
#
|
|
# replace_fn.mux - Test Cases for replace().
|
|
#
|
|
# Strategy: Exercise color and UTF-8 in combination with replace() behaviors.
|
|
#
|
|
@create test_replace_fn
|
|
-
|
|
@set test_replace_fn=INHERIT QUIET
|
|
-
|
|
#
|
|
# Beginning of Test Cases
|
|
#
|
|
&tr.tc000 test_replace_fn=
|
|
@log smoke=Beginning replace() test cases.
|
|
-
|
|
#
|
|
# Test Case #1 - Help file examples.
|
|
#
|
|
&tr.tc001 test_replace_fn=
|
|
@if cand(
|
|
strmatch(replace(This is a test, 4, quiz), This is a quiz),
|
|
strmatch(insert(Yet@Another@Mundane@List, 3, Funky, @), Yet@Another@Funky@Mundane@List)
|
|
)=
|
|
{
|
|
@log smoke=TC001: Help file examples. Succeeded.
|
|
},
|
|
{
|
|
@log smoke=TC001: Help file examples. Failed (replace=[replace(This is a test, 4, quiz)] insert=[insert(Yet@Another@Mundane@List, 3, Funky, @)]).
|
|
}
|
|
-
|
|
#
|
|
# Test Case #2 - Empty list. ASCII. Positive positions.
|
|
#
|
|
&tr.tc002 test_replace_fn=
|
|
@if cand(
|
|
eq(strlen(replace(,0,Pear,|)), 0),
|
|
eq(strlen(replace(,1,Pear,|)), 0),
|
|
eq(strlen(replace(,2,Pear,|)), 0)
|
|
)=
|
|
{
|
|
@log smoke=TC002: Empty list, ASCII, positive positions. Succeeded.
|
|
},
|
|
{
|
|
@log smoke=TC002: Empty list, ASCII, positive positions. Failed.
|
|
}
|
|
-
|
|
#
|
|
# Test Case #3 - Non-empty lists. ASCII. Positive positions.
|
|
#
|
|
&tr.tc003 test_replace_fn=
|
|
@if cand(
|
|
strmatch(replace(|,1,Pear,|), Pear|),
|
|
strmatch(replace(|,2,Pear,|), |Pear),
|
|
strmatch(replace(||,2,Pear,|), |Pear|),
|
|
strmatch(replace(|||,2,Pear,|), |Pear||)
|
|
)=
|
|
{
|
|
@log smoke=TC003: Non-empty lists, ASCII, positive positions. Succeeded.
|
|
},
|
|
{
|
|
@log smoke=TC003: Non-empty lists, ASCII, positive positions. Failed.
|
|
}
|
|
-
|
|
#
|
|
# Test Case #4 - Empty list. ASCII. Negative positions.
|
|
#
|
|
&tr.tc004 test_replace_fn=
|
|
@if cand(
|
|
eq(strlen(replace(,-2,Pear,|)), 0),
|
|
eq(strlen(replace(,-1,Pear,|)), 0)
|
|
)=
|
|
{
|
|
@log smoke=TC004: Empty list, ASCII, negative positions. Succeeded.
|
|
},
|
|
{
|
|
@log smoke=TC004: Empty list, ASCII, negative positions. Failed.
|
|
}
|
|
-
|
|
#
|
|
# Test Case #5 - Non-empty lists. ASCII. Negative positions.
|
|
#
|
|
&tr.tc005 test_replace_fn=
|
|
@if cand(
|
|
strmatch(replace(|,-1,Pear,|), |Pear),
|
|
strmatch(replace(|,-2,Pear,|), Pear|),
|
|
strmatch(replace(||,-1,Pear,|), ||Pear),
|
|
strmatch(replace(||,-2,Pear,|), |Pear|),
|
|
strmatch(replace(||,-3,Pear,|), Pear||)
|
|
)=
|
|
{
|
|
@log smoke=TC005: Non-empty lists, ASCII, negative positions. Succeeded.;
|
|
},
|
|
{
|
|
@log smoke=TC005: Non-empty lists, ASCII, negative positions. Failed.;
|
|
}
|
|
-
|
|
#
|
|
# Test Case #6 - Zero, oversized, and empty replacement behavior.
|
|
#
|
|
&tr.tc006 test_replace_fn=
|
|
@if cand(
|
|
strmatch(replace(a|b|c,0,Pear,|), a|b|c),
|
|
strmatch(replace(a|b|c,9,Pear,|), a|b|c),
|
|
strmatch(replace(a|b|c,2,,|), a||c),
|
|
strmatch(replace(a|b|c,-9,Pear,|), a|b|c)
|
|
)=
|
|
{
|
|
@log smoke=TC006: Zero, oversized, and empty replacement behavior. Succeeded.;
|
|
@trig me/tr.done
|
|
},
|
|
{
|
|
@log smoke=TC006: Zero, oversized, and empty replacement behavior. Failed (zero=[replace(a|b|c,0,Pear,|)] big=[replace(a|b|c,9,Pear,|)] empty=[replace(a|b|c,2,,|)] neg=[replace(a|b|c,-9,Pear,|)]).;
|
|
@trig me/tr.done
|
|
}
|
|
-
|
|
&tr.done test_replace_fn=
|
|
@log smoke=End replace() test cases.;
|
|
@notify smoke
|
|
-
|
|
drop test_replace_fn
|
|
-
|
|
#
|
|
# End of Test Cases
|
|
#
|