CIT590- assignment 4

This includes any an rniis rna additional functions

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: unctions, except the m i , p i t c t e , and p i t m p should be tested. This includes any an rn_iis rn_a, additional functions you might write. TDD, Te s t Drive n De s ign, really is a good idea. Here is the general approach: 1. Write a stub for each function. (A st ub is a function that does nothing or, if it must return a value, returns a value that is unlikely to be correct.) 2. Pick a function- - if possible, one that does not depend on any other functions you haven't yet written- and write a test for it. Run the test and make sure it fails. 3. Improve the function just enough to make it pass the test. 4. If the function needs to do more, then expand the test (or add another test) to test the new functionality. Run the test and make sure it fails. Then return to step 3. Repeat as many times as necessary until the function is complete. 5. If any functions remain to be written, return to step 2. Division of labor Put both names (yours and your partner's) in a comment at the top of both files. You may, if you wish, put your name in a comment in the major functions you have written; but you will both get the same grade for the www.cis.upenn.edu/~ matuszek/cit590- 2013/Assig nments/04- cir cuits- and- spanning - tr ees.html 3/4 2/3/13 CIT590 assignment. This assignment has been written to have a common part, and two easily separable problems. You should work with your partner as much as possible; but if you must work apart, one of you should work on the travelling salesman problem, and the other should work on the spanning tree problem. In the past, some students have tried the following: One partner writes the functions, and the other partner writes the test. Those students have told me, in no uncertain terms, that t his is a bad idea. Learn from their mistakes. Whoever writes a function should also write the tests for that function. Program m ing hints Import r n o at the top of your program; then n m e = 1 0 * r n o . a d m )will adm ubr 00 admrno( give you a floating- point number in the range 0 0 < n m e < 1 0 . . . =...
View Full Document

Ask a homework question - tutors are online