¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: [TDD] How do you write tests if you aren't sure what the result should be?


 

Hi Avi,

I'm not sure whether this is applicable to your situation, but I also had a
case where we were calculating some complex formulas and I couldn't get an
exact result predicted, simply because the system was meant to be able to
calculate those results with more precision than was possible before.

In that situation, we were able to define our (acceptance) tests to accept
approximate values, within a given range. So the expected outcome would for
instance be 0.546 +/- 0.5%
We also had to control some of the inputs to the system, such as the seed
used to generate random values that were used in the calculations, which
would normally change with time.

Is that something that might work in your circumstances?

Wouter

On Thu, Feb 14, 2013 at 5:31 PM, Charlie Poole <charliepoole@...>wrote:

Hi Avi,

If you had to test your work only by direct observation, what would you
look for?

Charlie


On Thu, Feb 14, 2013 at 7:21 AM, Avi Kessner <akessner@...> wrote:

**


Ill write more later when I'm at my desk, but the use case here is
matching
and predicting animations

On Feb 14, 2013 5:15 PM, "Steven Gordon" sgordonphd@...> wrote:

Even when the math is complicated, there should be inputs where the
results
are easy to hand compute. For example, where the inputs are
combinations
of 0s, 1s, -1s, etc. Those trivial cases should be enough to drive
development of properly structured code.

I would depend on customer-level tests to see if the computations are
properly supporting whatever "business" functionality the system is
supposed to deliver. If wrong answers still allows the user to do what
they need to do, then maybe the fancy formulas are overkill anyway.

SteveG

On Thu, Feb 14, 2013 at 12:24 AM, Avi Kessner akessner@...>
wrote:

**


Hi, I have a simple question.
I've been developing my program with TDD however I have hit a snag
and
I'm
not sure how to continue.
We have some complicated mathematical formulas that interact with
each
other The math is too complicated for me to resolve easily. These
formulas are calculated based on time. (For example, an elastic tween
formula)
I need to write a series of functions which predict what the steps of
the
formula will be. (How many timer ticks will it take to get to point
A?)

This is something that I feel can have tests, and needs tests. But I
have
no idea what to check or how to know if the test is correct.

My actual question is a meta-question by the way. How do I write
tests
when I don't know what the results should be, but I know the computer
needs
to get the "correct" result?

Thanks.

brought to you by the letters A, V, and I
and the number 47









------------------------------------

Yahoo! Groups Links











------------------------------------

Yahoo! Groups Links



--
Wouter Lagerweij | wouter@...
| @wouterla <!/wouterla>

Join [email protected] to automatically receive all group messages.