That's true, but it should be possible to do things like (as you kind of showed) [ 2 2 + ] [ 2 2 * ] unit-test and have useful output showing the differing results of each quotation. I think this would be a useful superset of current unit-test behavior, and not difficult to implement. (Right now, the first quotation is treated as a static stack and not executed. Maybe it should be changed to an array, to indicate that.)
Daniel Ehrenberg On 11/6/07, Doug Coleman <[EMAIL PROTECTED]> wrote: > Hi, > > If unit-test worked like you wanted, your first unit test wouldn't > test much besides "does the quotation I'm testing throw an > exception", because if [ 2 3 + ] somehow returned 7 it would still > pass. So a better unit test would involve checking a known answer, > like [ 5 ] [ 2 3 + ] unit-test. > > A way around computing the answer is to do it in the test quotation. > > [ t ] [ 2 2 * 2 2 + = ] unit-test > > [ t ] [ { 2 3 3 5 6 7 } >ulong-array dup natural-sort = ] unit-test > > > Doug > > On Nov 6, 2007, at 4:14 AM, Phil Dawes wrote: > > > Hi Factor list, > > > > I noticed that unit tests don't run the assertion quotation and > > compare > > the stack. e.g. the following fails: > > > > [ 2 3 + ] > > [ 2 3 + ] unit-test > > > > Is this by-design? If so, what's the rationale? > > > > The reason I ask is because it's a bit awkward for testing where the > > result is a type that doesn't have a convenient literal syntax. > > E.g. for > > my ulong-array class I have use the following: > > > > [ T{ ulong-array f > > B{ 2 0 0 0 3 0 0 0 3 0 0 0 5 0 0 0 6 0 0 0 7 0 0 0 } } ] > > [ { 5 3 2 6 7 3 } >ulong-array natural-sort ] unit-test > > > > rather than the more readable: > > > > [ { 2 3 3 5 6 7 } >ulong-array ] > > [ { 5 3 2 6 7 3 } >ulong-array natural-sort ] unit-test > > > > and I'd imagine this gets a lot more hairy for larger binary > > objects. Is > > there a way round this? > > > > Thanks, > > > > Phil > > > > > > ---------------------------------------------------------------------- > > --- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and a > > browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ > > Factor-talk mailing list > > Factor-talk@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/factor-talk > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk