No collaboration is allowed on this program assignment. Your program must be an individual and original effort. Except for any situations explicitly identified in this assignment, if any, you may only receive help from your instructor or the tutors provided by the Computer Science Department. See the Syllabus for the significant consequences for disallowed collaboration and/or plagiarism.
ErrataNone so far - updates and corrections, if any, will show up here (be sure to refresh this page as necessary).
Due Date and Submission InstructionsSubmit the following file(s) on one of the CSL servers using handin as follows:
file(s): FractionTest.java
touser: eaugusti
Your source code must meet the Programming Guidelines.
Minimally implement a class called Fraction to this
specification. This will allow you to compile and test your tests as you develop them. Recall that a minimally implemented class has no instance variables and no logic
except for the return statements necessary to satisfy the compiler.
Where possible, choose return values that are always wrong (would never be returned by a correct version of the method) so that tests checking for correct behavior will always fail. When no always-wrong value is then choose something clearly recognizable and
remember to not write tests expecting that value to be returned as the correct result.
In a class called FractionTest write SUnit tests (the class you wrote in Program 1a) for each of the public methods of the Fraction class including the constructors.
You must use SampleTest.java as the starting point for your FractionTest class. Use the save-as
feature of your browser (or wget/curl if you are a cool kid), not
cut-and-paste, to obtain a copy of SampleTest.java
At
a minimum you must write the following number of tests (you may write
more). Think about negative fractions (is the sign always carried in
the numerator as required by the Fraction class specification?),
positive fractions, and fractions that should be reduced, i.e., a
result that should be 1/2 is not something like 2/4 (Fraction objects
are always supposed to be stored in reduced form).
All of your non-boolean tests must report an error when compiled and run with a minimal implementation of the Fraction class.
Some of your boolean tests must report an error (all of your true-tests or all of your false-tests for a method depending on what the minimal implementation returns).
All of your tests must not report
an error when compiled and run with a
correct implementation of the Fraction class. You may not have a
correct implementation when this is due so develop them carefully!