reset password
Author Message
jroble52
Posts: 15
Posted 21:03 Mar 30, 2018 |

So I get that we're supposed to test every aspect of the class but what kind of tests are we supposed to do for instance variables? Testing if they're the same as what was put into the constructor? I looked in the slides and couldn't find anything on this.

Sorry for the foolish question

jhurley
Posts: 207
Posted 08:47 Mar 31, 2018 |

Use getters to test whether the numerator, denominator, and sign are correct for a fraction or whether the ints in a set are correct.  Test after creating the object, then after operations.  For example, for the fraction class, do a multiplication problem with one negative operand and one positive one and test whether the sign of the result is -.  For the fractions also, test to make sure the results of operations are in lowest terms.  For the set, be particularly careful to make sure there are never duplicate items in a set.   It will take *many* tests to do this right.