1

Can you test parts of a program or do you have to complete the whole program before you test it

2 Answers 2

2

If you want to test a program using check50, you don't have to wait to have the whole program completed although it's best if you do. Regardless, it will show you which parts are working correctly so far and which parts aren't complete yet.

For example, if you choose to test mario.c from pset1, it will tell whether the file has the right name, accepts the right kinds of values, etc.

The best judge of whether your program is working or not is yourself. When you see the result on the screen, you know if it's working correctly or not.

Personally, I tend to complete a program one step at a time, constantly testing to see if the part I added works. If my program has 3 steps, I'll write the program for the first step, then test it, then write the second step, and so on. That way it's easier to isolate the bugs because you know which part has been tested and which part hasn't.

The CS50 Appliance compiles in no time so there's really no limit to how many times you can edit and re-compile your program to test it out.

1

Well, depends on the size of the program. In my opinion, large programs get divided into smaller pieces where each piece is coded and tested up separately and then these pieces get attached together to form the whole program which in turn gets tested as a whole.

Small programs don't worth getting divided into smaller pieces. They're probably all coded and tested up as a whole.

To be honest, I haven't worked on "really large" projects yet, but for the projects I worked on that I think of as "large" for me, I definitely prefer coding and testing each part separately.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .