Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions check/fixes.frm
Original file line number Diff line number Diff line change
Expand Up @@ -3132,6 +3132,94 @@ Print +s;
assert succeeded?
assert result("test") =~ expr("0")
*--#] Issue544 :
*--#[ Issue554_1 :
CF f;
S x;
L F = f(x);
id f(x?{}) = x;
print;
.end
assert succeeded?
assert result("F") =~ expr("f(x)")
*--#] Issue554_1 :
*--#[ Issue554_2 :
CF f;
S x;
L F = f(x);
id f(x?!{}) = x;
print;
.end
assert succeeded?
assert result("F") =~ expr("x")
*--#] Issue554_2 :
*--#[ Issue554_3 :
CF f;
S x;
Set empty: ;
L F = f(x);
id f(x?empty) = x;
print;
.end
assert succeeded?
assert result("F") =~ expr("f(x)")
*--#] Issue554_3 :
*--#[ Issue554_4 :
CF f;
S x;
Set empty: ;
L F = f(x);
id f(x?!empty) = x;
print;
.end
assert succeeded?
assert result("F") =~ expr("x")
*--#] Issue554_4 :
*--#[ Issue554_5 :
CF f;
S x,y;
L F = f(1)+f(2)+f(3);
id f(x?{}) = x;
id f(y?{1,2}) = x^y;
print;
.end
assert succeeded?
assert result("F") =~ expr("x + x^2 + f(3)")
*--#] Issue554_5 :
*--#[ Issue554_6 :
#-
CF f,g,h,i;
S x;

#$x1 = f(1,3,5);
#$x2 = f();

#inside $x1
if (match(f(?a$a)));
endif;
#endinside
#inside $x2
if (match(f(?a$b)));
endif;
#endinside

L F = f(1,2,3,4,5,6);
L G = g(1,2,3,4,5,6);
L H = h(1,2,3,4,5,6);
L I = i(1,2,3,4,5,6);

repeat id f(?a,x? {`$a',},?b) = x * f(?a,?b);
repeat id g(?a,x?!{`$a',},?b) = x * g(?a,?b);
repeat id h(?a,x? {`$b',},?b) = x * h(?a,?b);
repeat id i(?a,x?!{`$b',},?b) = x * i(?a,?b);

P;
.end
assert succeeded?
assert result("F") =~ expr("15*f(2,4,6)")
assert result("G") =~ expr("48*g(1,3,5)")
assert result("H") =~ expr("h(1,2,3,4,5,6)")
assert result("I") =~ expr("720*i")
*--#] Issue554_6 :
*--#[ Issue563 :
#: SubTermsInSmall 64

Expand Down Expand Up @@ -3312,6 +3400,39 @@ Local test3 = 3;
#pend_if mpi?
assert runtime_error?("isnumerical: expression is not yet defined!")
*--#] Issue577_2 :
*--#[ Issue599 :
#-
On names;
Off statistics;
CFunction A1,...,A6;
Symbol j,x,z,y;

Local ff =
+ A1(1) + A2(2) + A3(3)
+ A4(1) + A5(2) + A6(3)
;

Identify A1(j?{1,2,3}[x]) = A1({ 10, 20, 30}[x]);
Identify A2(j?{1,2,3}[x]) = A2({+10,+20,+30}[x]);
Identify A3(j?{1,2,3}[x]) = A3({-10,-20,-30}[x]);
Identify A4(j?{1,2,3}[x]) = A4({+-10,--20,-+30}[x]);
Identify A5(j?{1,2,3}[x]) = A5({--10,-+20,+-30}[x]);
Identify A6(j?{1,2,3}[x]) = A6({-+10,+-20,--30}[x]);

Print;
.end
assert succeeded?
assert result("ff") =~ expr("A1(10) + A2(20) + A3(-30) + A4(-10) + A5(-20) + A6(30)")
assert stdout =~ exact_pattern(<<'EOF')
Sets
{}: 1 2 3
{}: 10 20 30
{}: -10 -20 -30
{}: -10 20 -30
{}: 10 -20 -30
{}: -10 -20 30
EOF
*--#] Issue599 :
*--#[ PullReq535 :
* This test requires more than the specified 50K workspace.
#:maxtermsize 200
Expand Down
5 changes: 4 additions & 1 deletion sources/names.c
Original file line number Diff line number Diff line change
Expand Up @@ -2160,7 +2160,10 @@ int DoElements(UBYTE *s, SETS set, UBYTE *name)
while ( *s ) {
if ( *s == ',' ) { s++; continue; }
sgn = 0;
while ( *s == '-' || *s == '+' ) { sgn ^= 1; s++; }
while ( *s == '-' || *s == '+' ) {
if ( *s == '-' ) sgn ^= 1;
s++;
}
cname = s;
if ( FG.cTable[*s] == 0 || *s == '_' || *s == '[' ) {
if ( ( s = SkipAName(s) ) == 0 ) {
Expand Down
11 changes: 11 additions & 0 deletions sources/wildcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -2257,6 +2257,17 @@ WORD CheckWild(PHEAD WORD oldnumber, WORD type, WORD newnumber, WORD *newval)
*/
w = SetElements + Sets[j].first;
m = SetElements + Sets[j].last;
if ( w == m ) {
/*
The set is empty! This is not a match unless we have !{}, in
which case it is.
*/
if ( notflag ) return 0;
AN.oldtype = old2;
AN.oldvalue = oldval;
goto NoMatch;
}

if ( ( Sets[j].flags & ORDEREDSET ) == ORDEREDSET ) {
/*
We search first and ask questions later
Expand Down
Loading