I want to learn TDD for working in Linear Algebra (or basically with matrices) in scientific programming(quantum chemistry). However since intermediates are not known and the only thing sometimes known are the end results I dont know how to do it.
Can you show me how you would do TDD in the above example?
for i,j = start1:end1, k,l = start2:end2
A[i,j] = B[i,k] * C[k,l] * D[l,j]
end
with A being the new Matrix calculated in the function.
with B C D being predefined Matrices.
with start1, start2, end1, end2 being predefined integers.
In a usual program I have around 20 of these blocks. So I think I dont know anything about the new A.
Most bugs I have are simple typing errors like doing
B[k,i]
instead of the above.
The only debugging scheme I am able to do if the end result is wrong is to write everything twice and then checking both A and hope I have not done the same typing error twice.
THX for your help
Aucun commentaire:
Enregistrer un commentaire