jeudi 30 avril 2015

Structuring procedural code for unit tests

If you're planning to write unit tests for a C program, what is the convention for placement of the main function? Do you put it in it's own separate file, with the functions in another file, that way you can include the functions file inside a test without having conflicts with two main methods? This makes sense to me but just wondering if there's a certain convention.

I ask because we have several SQR programs at work that are a difficult to maintain, and I'd like to take a stab at getting them under test, but I need a way to call the functions from another file, so I figured my first step would be to take the begin-program - end-program section and stick it in a separate file.

Aucun commentaire:

Enregistrer un commentaire