[Aimmath-commit] AIM/WEB-INF/maple/aim Test.mpl,1.6,1.7
Brought to you by:
gustav_delius,
npstrick
|
From: <gus...@us...> - 2003-11-02 01:30:45
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim
In directory sc8-pr-cvs1:/tmp/cvs-serv8717/WEB-INF/maple/aim
Modified Files:
Test.mpl
Log Message:
Fixed `aim/TestSet` and `aim/TestNumericSet` by converting sets to lists and sorting them before testing
Index: Test.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Test.mpl,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Test.mpl 19 Sep 2003 20:13:19 -0000 1.6
--- Test.mpl 2 Nov 2003 01:30:39 -0000 1.7
***************
*** 116,120 ****
`Package/Assign`(
`aim/TestExtended_numeric`::boolean,
! "Returns @`aim/TestNumeric`(ans,rightans)@ if @ans@ and @rightans@ are both @numeric@, otherwise it returns @`aim/TestEqual`(ans,rightans)@. This allows the @ans@ and @rightans@ to be one of @{infinity,-infinity,undefined}@
",
proc(ans::anything,
--- 116,123 ----
`Package/Assign`(
`aim/TestExtended_numeric`::boolean,
! "Returns @`aim/TestNumeric`(ans,rightans)@ if @ans@ and @rightans@ are
! both @numeric@, otherwise it returns @`aim/TestEqual`(ans,rightans)@.
! This allows the @ans@ and @rightans@ to be one of
! @{infinity,-infinity,undefined}@
",
proc(ans::anything,
***************
*** 389,421 ****
######################################################################
- # Test whether ans is equal to the set rightans.
- # By default, this just compares entries using ans[i] = rightans[i].
- # If a third argument 'testproc' is supplied, it instead compares
- # entries using testproc(ans[i],rightans[i]).
`Package/Assign`(
`aim/TestSet`::boolean,
! "",
proc(ans,rightans::set,
# optional
testproc_)
! local i,testproc;
!
! if nargs > 2 then
! testproc := eval(testproc_);
! else
! testproc := eval(`aim/TestEqual`);
! fi;
!
! if type([ans],[set]) and nops(ans) = nops(rightans) then
! for i from 1 to nops(rightans) do
! if evalb(testproc(ans[i],rightans[i])) <> true then
! RETURN(false);
! fi;
! od;
! RETURN(true);
else
! # ans is not a set of the right length
! RETURN(false);
fi;
end
--- 392,407 ----
######################################################################
`Package/Assign`(
`aim/TestSet`::boolean,
! "Test whether @ans@ is equal to the set @rightans@.
! Do this by converting them to lists, sorting them and then call @`aim/TestList`@",
proc(ans,rightans::set,
# optional
testproc_)
! if (nargs = 2) then
! `aim/TestList`(sort(convert(ans,list)),sort(convert(rightans,list)));
else
! `aim/TestList`(sort(convert(ans,list)),sort(convert(rightans,list)),testproc_);
fi;
end
***************
*** 424,443 ****
######################################################################
- ###TODO: this is not robust, and may not be useful
`Package/Assign`(
`aim/TestNumericSet`,
! "",
proc(ans::anything,
rightans::set(numeric),
# optional
marginspec_::`aim/Test/MarginSpecification`)
- global MARGINSPEC;
-
if (nargs = 2) then
! `aim/TestSet`(ans,rightans,`aim/TestNumeric`);
else
! `aim/TestSet`(ans,rightans,
! subs(MARGINSPEC = marginspec_,
! (a,b) -> `aim/TestNumeric`(a,b,MARGINSPEC)));
fi;
end
--- 410,425 ----
######################################################################
`Package/Assign`(
`aim/TestNumericSet`,
! "Test whether @ans@ is equal to the set @rightans@.
! Do this by converting them to lists, sorting them and then calling @`aim/TestNumericList`@",
proc(ans::anything,
rightans::set(numeric),
# optional
marginspec_::`aim/Test/MarginSpecification`)
if (nargs = 2) then
! `aim/TestNumericList`(sort(convert(ans,list)),sort(convert(rightans,list)));
else
! `aim/TestNumericList`(sort(convert(ans,list)),sort(convert(rightans,list)),marginspec_);
fi;
end
|