I don't even want to know what is going on in these cycles. You should simply use input data and expected result data, which you mostly define  manually.