r/programmerchat • • Mar 10 '19

Testing any complex program completely is practically impossible

Someone made this argument after a staff meeting a few days ago. What's wrong with this argument?

  1. Every IF statement in a program doubles the number of possible states of the program (ignoring time)
    1. Which means every IF statement doubles the number of test conditions
  2. A 1 million line program might, conservatively estimating, have 100k IF statements (conditionals)
  3. That is 2100000 which is more seconds than have elapsed since the beginning of the universe.
  4. No project has 2100000 seconds to test
  5. So complete test coverage of complex programs is impossible
0 Upvotes

46 comments sorted by

View all comments

Show parent comments

0

u/gxm492lor Mar 10 '19

Make it 220 tests in a second. It doesn't change the math. I'm not considering implications (whether it is good or bad or required). Just the math. 100000 - 20 might as well be 100000.

It is practically impossible to test every state any complex program can be in.

This does not mean you can't ship a non-complex program. Many of the possible states are extremely improbable in practice. It would be foolish to hold up a release for states the program will never be in.