Original Post
Probably most people related to programming have heard about auto-testing their programs. Auto-testing refers to writing, for each routine in your program, of another routine that would test the first routine's correctness. For example, suppose you have implemented a function pow(x, y) that raises x to power y. Then you would have a testing routine that could look like this: void pow_autotest() { if ((pow(1, 10) == 1) && (pow(2, 5) == 32)) std::cout<<"OK"<<std::endl; else std::cout<<"error!"<<std::endl; } Basically, the idea is that you test the function for some inputs for which you know the correct answer. You then hope that if it behaves OK on these inputs, then probably it also behaves OK on all other inputs. My question is, how do you do it for a very complex routine? It was easy to pick some inputs to pow for which you know the answer. But suppose you implement back-propagation in a neural network. So you have a routine that receives the network and a set of training examples, and returns the trained network. How do you choose the test case when you know the correct output weights? I probably could reasonably simply derive the correct answer analytically in trivial cases (like one neuron with one synapse). But this is kind of a boundary case (like 1^10 in pow). A better test would be a two-layer network with two neurons per layer. But I would have no idea what the correct final weights are. Calculating them by hand could also be difficult. Imagine that you train on 50 examples and so calculate 50 updates. Or you train on just two examples, but then it takes 50 iterations to converge. Or you want to test a routine for rendering a 3D object, etc. Does anyone have experience with autotesting complex algorithms?