Algorithms and OOD (CSC 207 2014S) : Assignments
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Java 7 API] [Java Code Conventions] [GNU Code Conventions]
Related Courses: [CSC 152 2006S (Rebelsky)] [CSC 207 2013F (Rebelsky)] [CSC 207 2013S (Walker)] [CSC 207 2011S (Weinman)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)] [Issue Tracker (Textbook)]
This makeup is still in draft form.
A few of you had some significant problems on exam 2. Since there were unit tests for exam 2, I don't think that a makeup that simply asks you to correct your already buggy implementations is appropriate. I've also had very little luck with such makeup examinations. Hence, this makeup primarily asks you to reflect in new ways on a few issues from the examination.
Additional issues
Clone the repository at https://github.com/Grinnell-CSC207/makeup2-2014S.
As the examination suggested, I try to use some interesting approaches in my unit tests. For this problem, you need to explore and explain a few of those approaches. Your goal is to explain the approaches to someone who hasn't seen my code, but wants guidance in strategies for writing more sophisticated unit tests. You can treat them as if they are 'blog posts.
a. Explain how one might use factories in writing unit tests. You may need to teach yourself about factories in order to complete this problem.
b. Explain at least two ways in which one might use permutations in testing. For example, you might explain about randomized permutations and all permutations.
In the repository, you will find two implementations of filtered iterators, along with a skeletal set of unit tests. Both implementations passed my unit tests, but one has a large number of flaws. Your goal is to write a set of tests that will identify some of those flaws. (I believe that the good implementation is correct; you will get extra credit if you identify flaws in that implementation.) Your tests must illustrate the following flaws:
next return null, even when null is not
in the underlying collection. Put a test that reveals this issue
in testNext1.next
correctly returns some values in the underlying iterator and only returns
values in the underlying iterator that meet the predicate, but fails to
return the correct value for some of the calls to next.
next,
rather than a flaw in hasNext or remove. Put a test that reveals
this issue in testNext2.hasNext. Put a test that reveals this issue in testNext3.remove remove the wrong element (that is,
something other than what was most recently returned by next).
Put a test that reveals this issue in testRemove1. Note that
the problem might be that the code calls base.remove() when it
should be throwing an exception.hasNext return the wrong value (either
true when there should not be remaining elements, or false when
there should be remaining elements). Put a test that reveals this
issue in testHasNext1.Ideally, you will find that BadFilteredIterator fails these five tests
(and passes the two sample tests) and that GoodFilteredIterator passes
all the tests.
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Java 7 API] [Java Code Conventions] [GNU Code Conventions]
Related Courses: [CSC 152 2006S (Rebelsky)] [CSC 207 2013F (Rebelsky)] [CSC 207 2013S (Walker)] [CSC 207 2011S (Weinman)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)] [Issue Tracker (Textbook)]
Copyright (c) 2013-14 Samuel A. Rebelsky.

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this
license, visit http://creativecommons.org/licenses/by/3.0/
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.