Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Unit testing in Mathematica or Wolfram Workbench
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Andrew Moylan  
View profile  
 More options Aug 21 2007, 5:14 am
Newsgroups: comp.soft-sys.math.mathematica
From: "Andrew Moylan" <andrew.j.moy...@gmail.com>
Date: Tue, 21 Aug 2007 09:14:19 +0000 (UTC)
Local: Tues, Aug 21 2007 5:14 am
Subject: Unit testing in Mathematica or Wolfram Workbench
I want to set up unit tests for a numerical algorithm. I'd like to test the
timing of the algorithm (and consider 1.00 seconds and 1.02 seconds as the
same, etc) and the numerical result (and consider 5.6000000000 and
5.6000000002 to be the same result, etc).

1. Is the testing system in Wolfram Workbench adequate for this purpose? Can
it do the kind of "fuzzy" comparisons I sometimes require? I can't find much
documentation on this testing system beyond the screencast at
http://www.wolfram.com/products/workbench/workflow/WorkbenchTesterDem...
and the small amount of written how-to type information in the Workbench
help. Can someone point me to more documentation?

2. Is there an existing add-on package that is good for this purpose?

3. What does Wolfram use internally for unit testing of Mathematica code?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Moylan  
View profile  
 More options Aug 23 2007, 1:33 am
Newsgroups: comp.soft-sys.math.mathematica
From: Andrew Moylan <andrew.j.moy...@gmail.com>
Date: Thu, 23 Aug 2007 05:33:52 +0000 (UTC)
Local: Thurs, Aug 23 2007 1:33 am
Subject: Re: Unit testing in Mathematica or Wolfram Workbench
Adam Berry at Wolfram responded directly to me about this post,
confirming that the answer to question 1 is Yes. Test[] has an option
called EquivalenceFunction that has default value SameQ but can be
modified arbitrarily. It's easy enough to write a custom
EquivalenceFunction to compare numbers to a given precision or
accuracy. Adam gave the example:

Define

MyEquivalenceFunc[actual_,expected_]:= expected - 0.2 < actual <
expected + 0.2

then use

Test[..., EquivalenceFunction->MyEquivalenceFunc]

If you want it to look neater, or if you often have a need for this
sort of fuzzy comparison when writing your own numerical algorithms,
you might find a use for my (trivial, almost one-line) package
ApproximatelyEqual`. I've uploaded it to http://andrew.j.moylan.googlepages.com/mathematica.
Just look at ApproximatelyEqual.nb to see precisely how it defines
approximate equality (it's based on what I gather Mathematica does in
its own algorithms).

Test[] also has a bunch of other options and arguments that you might
want, such as for testing which messages are generated while
evaluating an expression. Evaluate Options[Test] in a test file, or
just browse the simple source code for MUnit` (located in the
Workbench installation folder).

On Aug 21, 7:14 pm, "Andrew Moylan" <andrew.j.moy...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google