¿ªÔÆÌåÓý

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,

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

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?)
Is it possible to redefine the question? You could gain confidence by
testing the algorithm behaves as expected with given clock values, instead
of having to guess (and have test failures when running the suite on a
machine capable of more operations / tick).


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?

If I do not know what the result should be, I have to assume the
computation provides the "correct" result. At this point I default to
validating the computation - I don't know what the answer will be, but I
know we have to be doing things "this" way. I feel bad resorting to this
(it makes the software brittle and resistant to change), but if I can't
check my work in the future because I don't know what the results should
be, I have to guard the one source of truth I have (the algorithm).

Cheers!
Carl

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