Update of /cvsroot/stack/stack-dev/maxima In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv12303/maxima Modified Files: Tag: grobner stackmaxima.mac unittests_load.mac Added Files: Tag: grobner rtest_assessment_simpboth.mac rtest_assessment_simpfalse.mac rtest_assessment_simptrue.mac Log Message: Changes to the unit testing scheme to link into Maxima's own testing system. Index: unittests_load.mac =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/unittests_load.mac,v retrieving revision 1.4 retrieving revision 1.4.16.1 diff -C2 -d -r1.4 -r1.4.16.1 *** unittests_load.mac 11 Dec 2008 12:15:02 -0000 1.4 --- unittests_load.mac 1 Dec 2010 13:27:23 -0000 1.4.16.1 *************** *** 5,36 **** /* NOTE: we need to run tests with simp:false and simp:true */ - UT(ex,r):= if not(equal(ev(ex,nouns),r)) then ( - no_fails:ev(no_fails+1,simp), - all_pass:false, - print(sconcat(string(ex))," gave ",string(ev(ex,nouns))," not ",string(r)) - )$ - - /* Display the results */ - UTD(ex,r):= block( - if ev(ex,nouns)#r then ( - no_fails:ev(no_fails+1,simp), - all_pass:false, - outcome:" FAILED" - ) - else - outcome:" PASSED", - print(sconcat(string(ex))," gave ",string(ev(ex,nouns))," Expecting ",string(r),outcome) - )$ no_fails:0$ all_pass:true$ ! simp:true$ print("simp is ",simp); ! load("unittests.mac"); ! simp:false$ print("simp is ",simp); ! load("unittests.mac"); - if all_pass then - (print("All tests passed"),true) - else - (print("Number of tests which failed: "),print(string(no_fails)),false)$ --- 5,26 ---- /* NOTE: we need to run tests with simp:false and simp:true */ no_fails:0$ all_pass:true$ ! simp:true$ ! STT:batch("rtest_assessment_simptrue.mac", test); ! STB:batch("rtest_assessment_simpboth.mac", test); ! ! simp:false$ ! SFF:batch("rtest_assessment_simpfalse.mac", test); ! SFB:batch("rtest_assessment_simpboth.mac", test); ! ! print("************ simp is true"); ! print(STT); ! print(STB); ! ! print("************ simp is false."); ! print(SFF); ! print(SFB); --- NEW FILE: rtest_assessment_simpboth.mac --- decimalplaces(1.123456789,3); 1.123$ decimalplaces(1.123456789,8); 1.12345679$ decimalplaces(1.1292,2); 1.13$ decimalplaces(%pi,5); 3.14159$ decimalplaces(%pi,4); 3.1416$ significantfigures(11292,2); 11000$ significantfigures(11292,3); 11300$ significantfigures(1.1292,3); 1.13$ significantfigures(0.011292,3); 0.0113$ significantfigures(0.09999,3); 0.1$ scientific_notation(1.123); 1.123$ scientific_notation(1123); 1123.0$ all_listp(real_numberp,[1,exp(1)^(%i*%pi),sqrt(2)+1,sin(1)]); true$ any_listp(real_numberp,[%i,%i+1,3+x,sqrt(-3)+1]); false$ expandp((x-1)*(1+x)); false$ expandp(2*(x-1)); false$ expandp(2*x-1); true$ expandp(x-1); true$ expandp((p-1)*(1+p)); false$ expandp(2*(p-1)); false$ expandp(3*y+6*p); true$ stack_ineqprepare(x>1); x-1>0$ list_expression_numbers(x); []$ list_expression_numbers(%pi); []$ list_expression_numbers(1+x); [1]$ list_expression_numbers(1/2+x); [1/2]$ list_expression_numbers(4/2+x); [4/2]$ list_expression_numbers(1/sin(2*x)); [1,2]$ filter(floatnump,0.5); false$ filter(floatnump,[0.5]); [0.5]$ filter(floatnump,[1,0.5]); [0.5]$ anyfloatex(0.5); true$ anyfloatex(x); false$ anyfloatex(1+x); false$ anyfloatex(0.5*x); true$ anyfloatex(sin(x*0.2)); true$ irred_Q(0,x); [true,""]$ irred_Q(x,x); [true,""]$ irred_Q(1+x,x); [true,""]$ irred_Q(1-x,x); [true,""]$ irred_Q(2-3*x,x); [true,""]$ irred_Q(2*x-2,x); [false,"stack_trans('irred_Q_commonint'); "]$ irred_Q(t+t*x,x); [false,""]$ irred_Q(3*x^2,x); [true,""]$ irred_Q(4*x^2,x); [true,"stack_trans('irred_Q_optional_fac' , !quot!$4\\,x^2$!quot! ); "]$ irred_Q(x^2-4,x); [false,""]$ irred_Q(x^2-2,x); [true,""]$ irred_Q(n+n^2,n); [false,""]$ irred_Q(n*(1+n),n); [false,""]$ irred_Q(n^3-1,n); [false,""]$ irred_Q(0.5+x,x); [true,""]$ irred_Q(2-3*x+x^2,x); [false,""]$ irred_Q(9-3*x+3*x^5,x); [false,"stack_trans('irred_Q_commonint'); "]$ irred_Q(1+x^2+x^5,x); [true,""]$ continuousp(x^2,x,1); true$ continuousp(abs(x),x,1); true$ continuousp(abs(x),x,0); true$ continuousp(sgn(x),x,0); false$ continuousp(sin(1/x),x,0); false$ continuousp(x*sin(1/x),x,0); true$ diffp(x^2,x,1); true$ diffp(abs(x),x,1); true$ diffp(abs(x),x,0); false$ diffp(sgn(x),x,0); false$ diffp(sin(1/x),x,0); false$ diffp(x^2*sin(1/x),x,0); false$ diffp(x^3*sin(1/x),x,0); true$ listsoverlap([1,2],[2,3]); true$ listsoverlap([8,9],[2,3]); false$ listscontain([1,2],[2,3],1); false$ listscontain([8,9],[2,3],1); false$ listscontain([1,2],[1,3],1); true$ subst_int_const(x^4/4+c*x+x = %c9,k); x^4/4+c*x+x = k$ subst_int_const(x^4/4+c*x+x = %c9,v); x^4/4+c*x+x = v$ subst_int_const(x^2,k); x^2$ subst_int_const(c*x^4/4+c^2*x/2+c*x = %c9*c+%c10,[v]); c*x^4/4+c^2*x/2+c*x = %c9*c+v$ subst_int_const(c*x^4/4+c^2*x/2+c*x = %c9*c+%c10,[k1,k2]); c*x^4/4+c^2*x/2+c*x = k1+c*k2$ subst_int_const(c*x^4/4+c^2*x/2+c*x = %c9*c+%c10,[k1,k2,k3]); c*x^4/4+c^2*x/2+c*x = k1+c*k2$ subst_equiv(y+x^2,1+a^2); []$ subst_equiv(1-2*x+x^2,(X-1)^2); [x = X]$ subst_equiv(y+x^2,b+a^2); [x = a,y = b]$ subst_equiv(y+x^2,b+a^2); [x = a,y = b]$ subst_equiv(y/z+x^2,c/b+a^2); [x = a,y = c,z = b]$ subst_equiv(y/z+x^2,z/x+y^2); [x = y,y = z,z = x]$ subst_equiv(y+x^2,x^2+y^2); []$ subst_equiv(u^6+w^5+v^4+z^3+y^2+x,f+g^2+d^3+c^4+b^5+a^6); false$ subst_equiv(w+u+v+y+x^2,w+v+y+b+a^2); [u = b,x = a]$ exdowncase(1+X+X^2); 1+x+x^2$ exdowncase(%pi); %pi$ stack_assignmentp(x = 1); true$ stack_assignmentp(x = sqrt(2)); true$ stack_assignmentp(3 = 1); false$ stack_assignmentp(d = v*t); false$ stack_assignmentp(1 = x); false$ stack_op(1); ""$ stack_op(x); ""$ stack_op(%pi); ""$ stack_op(z+3); "+"$ stack_op(3*z); "*"$ stack_op(3^z); "^"$ stack_op(3/z); "/"$ stack_op(sin(3*z)); "sin"$ stack_op((-1)/(1+x^2)); "/"$ stack_op(1-x); "+"$ stack_op(x-1); "+"$ stack_op(-(x-1)); "+"$ stack_op(-1/(1+x^2)); "/"$ stack_op(-2*x); "*"$ StackDISP(a/b,""); "\\frac{a}{b}"$ StackDISP(-27,""); "-27"$ StackDISP(-sin(x^2),""); "-\\sin \\left( x^2 \\right)"$ StackDISP(asin(x),""); "\\sin^{-1} \\left( x \\right)"$ StackDISP(log(x),""); "\\ln \\left( x \\right)"$ strip_int_const(k+x,x); x$ strip_int_const(k+1+x,x); 1+x$ strip_int_const(k^2+(x-1)^2,x); (x-1)^2$ strip_int_const(c+(t-1)^4/4,t); (t-1)^4/4$ --- NEW FILE: rtest_assessment_simptrue.mac --- exdowncase(X-x); 0$ list_expression_numbers(0.3*x+1/2); [0.3,1/2]$ StackDISP(-(x-1),""); "1-x"$ --- NEW FILE: rtest_assessment_simpfalse.mac --- factorp(x); true$ factorp(2); true$ factorp(4); false$ factorp(2^2); true$ factorp(2^2*x^3); true$ factorp(x^2); true$ factorp(y^2*x^2); true$ factorp((y*x)^2); true$ factorp((x-1)*(1+x)); true$ factorp((x-1)^2); true$ factorp((1-x)^2); true$ factorp(2*(x-1)); true$ factorp(2*x-1); true$ factorp(x^2-1); false$ factorp(1+x^2); true$ factorp((x-1)*(1+x)); true$ factorp((x-%i)*(%i+x)); true$ factorp(4*(x-1/2)^2); false$ commonfaclist([12,15]); 3$ commonfaclist([12,15,60,9]); 3$ commonfaclist([x^2-1,x^3-1]); x-1$ commonfaclist([x = 6,8]); 1$ factorlist(15); [3,5]$ factorlist(x^3-1); [x-1,1+x+x^2]$ lowesttermsp(x); true$ lowesttermsp(0.5); true$ lowesttermsp(1/2); true$ lowesttermsp((-1)/2); true$ lowesttermsp(1/(-2)); true$ lowesttermsp((-3)/6); false$ lowesttermsp((-x)/x^2); false$ lowesttermsp(15/3); false$ lowesttermsp(3/15); false$ lowesttermsp((x-1)/(x^2-1)); false$ lowesttermsp(x/(x^2-1)); true$ lowesttermsp((2+x)/(x^2-1)); true$ all_lowest_termsex(x); true$ all_lowest_termsex(0.5); true$ all_lowest_termsex(1/2); true$ all_lowest_termsex(2/4); false$ all_lowest_termsex(15/3); false$ all_lowest_termsex(0.3*x^2+3/15); false$ all_lowest_termsex(x/(x^3+x)); true$ list_expression_numbers(0.3*x+1/2); [1/2,0.3]$ exdowncase(X-x); x-x$ StackDISP(-(x-1),""); "-\\left(x-1\\right)"$ Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/stackmaxima.mac,v retrieving revision 1.84.2.6 retrieving revision 1.84.2.7 diff -C2 -d -r1.84.2.6 -r1.84.2.7 *** stackmaxima.mac 18 Nov 2010 09:53:52 -0000 1.84.2.6 --- stackmaxima.mac 1 Dec 2010 13:27:23 -0000 1.84.2.7 *************** *** 1847,1851 **** subst_int_const(ex,v):=block([lv,li,ls], lv:listofvars(ex), ! li:sublist_indices(lv, lambda([ex],is(smismatch("integrationconstant",string(ex))>19)) ), if emptyp(li) then return(ex), /* If we have only one variable v, then use this */ --- 1847,1851 ---- subst_int_const(ex,v):=block([lv,li,ls], lv:listofvars(ex), ! li:sublist_indices(lv, lambda([ex],is(smismatch("integrationconstant",string(ex))>19) or is(smismatch("%c",string(ex))>2)) ), if emptyp(li) then return(ex), /* If we have only one variable v, then use this */ *************** *** 1856,1864 **** /* This function strips off any trailing constant of integration from an expression, which is not a number */ ! strip_int_const(ex,v):=block([ex2], ex2:ex, ! if not(atom(ex)) then ! if op(ex)="+" then ! ex2:apply("+",filter(lambda([ex2],not(freeof(v,ex2)) or simp_numberp(ex2)),args(ex))), return(ex2))$ --- 1856,1865 ---- /* This function strips off any trailing constant of integration from an expression, which is not a number */ ! strip_int_const(ex,v):=block([ex2,fargs], ex2:ex, ! if atom(ex) then return(ex), ! if op(ex)="+" then ! (fargs:filter(lambda([ex2],not(freeof(v,ex2)) or simp_numberp(ex2)),args(ex)), ! if length(fargs)=1 then ex2:fargs[1] else ex2:apply("+",fargs)), return(ex2))$ |