mirror of
https://github.com/brazilofmux/tinymux
synced 2026-08-13 00:23:11 -04:00
These files each had a single happy-path case. Add boundary, empty,
duplicate, sort-order and not-found cases that lock down the documented
semantics:
setunion / setinter / setdiff
- empty operands (one side empty, both empty, remove-everything)
- duplicate removal within and across lists; identical single-element
union collapses to one element
- default sort is ASCII, so "10" sorts before "2"; the fifth arg selects
numeric sort; the fourth arg overrides the output separator
before / after
- separator at the lead / trailing / repeated positions (first-occurrence
semantics): before() yields the head and after() the tail
- separator absent: before() returns the whole string, after() returns empty
- empty separator defaults to a single space (with space-trim); multi-
character separators match whole
Smoke 1090/0/0. Part of #757 (single-case-per-function coverage).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
73 lines
1.8 KiB
Text
73 lines
1.8 KiB
Text
#
|
|
# setdiff_fn.mux - Test Cases for setdiff().
|
|
#
|
|
@create test_setdiff_fn
|
|
-
|
|
@set test_setdiff_fn=INHERIT QUIET
|
|
-
|
|
#
|
|
# Beginning of Test Cases
|
|
#
|
|
&tr.tc000 test_setdiff_fn=
|
|
@log smoke=Beginning setdiff() test cases.
|
|
-
|
|
#
|
|
# Test Case #1 - Basic set difference.
|
|
#
|
|
&tr.tc001 test_setdiff_fn=
|
|
@if cand(
|
|
strmatch(setdiff(a b c d,b d), a c),
|
|
strmatch(setdiff(a|b|c|d,b|d,|), a|c)
|
|
)=
|
|
{
|
|
@log smoke=TC001: setdiff basic operations. Succeeded.
|
|
},
|
|
{
|
|
@log smoke=TC001: setdiff basic operations. Failed (setdiff=[setdiff(a b c d,b d)] setdiff|=[setdiff(a|b|c|d,b|d,|)]).
|
|
}
|
|
-
|
|
#
|
|
# Test Case #2 - Set difference (list1 minus list2). An empty list2 leaves
|
|
# list1 (sorted, de-duplicated); an empty list1, or removing everything,
|
|
# yields the empty set.
|
|
#
|
|
&tr.tc002 test_setdiff_fn=
|
|
@if cand(
|
|
strmatch(setdiff(a b c,), a b c),
|
|
eq(strlen(setdiff(,a b)), 0),
|
|
eq(strlen(setdiff(a b,a b)), 0)
|
|
)=
|
|
{
|
|
@log smoke=TC002: setdiff empty operands. Succeeded.
|
|
},
|
|
{
|
|
@log smoke=TC002: setdiff empty operands. Failed (l2empty=[setdiff(a b c,)] l1empty=[setdiff(,a b)] allgone=[setdiff(a b,a b)]).
|
|
}
|
|
-
|
|
#
|
|
# Test Case #3 - Duplicates in list1 collapse to one; the kept elements come
|
|
# out in ASCII sort order (so "10" precedes "2").
|
|
#
|
|
&tr.tc003 test_setdiff_fn=
|
|
@if cand(
|
|
strmatch(setdiff(a a b c d,b d), a c),
|
|
strmatch(setdiff(2 10 1,1), 10 2)
|
|
)=
|
|
{
|
|
@log smoke=TC003: setdiff duplicates and sort. Succeeded.;
|
|
@trig me/tr.done
|
|
},
|
|
{
|
|
@log smoke=TC003: setdiff duplicates and sort. Failed (dups=[setdiff(a a b c d,b d)] sort=[setdiff(2 10 1,1)]).;
|
|
@trig me/tr.done
|
|
}
|
|
-
|
|
&tr.done test_setdiff_fn=
|
|
@log smoke=End setdiff() test cases.;
|
|
@notify smoke
|
|
-
|
|
drop test_setdiff_fn
|
|
-
|
|
#
|
|
# End of Test Cases
|
|
#
|