4 ms·
How do you TDD experimental/evolving code? I work on scientific algorithms, where there are typically only few lines of code that constantly evolve to improve s
by Derbasti 11y ago
How do you TDD experimental/evolving code? I work on scientific algorithms, where there are typically only few lines of code that constantly evolve to improve some performance metric.
I have been struggling for a while to integrate testing into my work. TDD is easy and perfectly suited for "normal" software development, where there is some kind of plan, and you are writing a lot of code that changes little after it is written.
I'd be very interested in pointers on how to apply TDD to little code that changes a lot after it is initially written.
- pmarreck 11y agoDo you mean you work with evolutionary algorithms? One thing testing does require is determinism. In other words, given all input states X(1) through X(N), output Z should result 100% of the time. If that is not the case, then you haven't accounted for all input states (for example, code that looks at the time and acts based on that- the time is an oft-unaccounted-for input) or you have code that calls something like rand() without a seed. If you can get your code into a deterministic state, then it is testable.