CSC151.02 2015S, Class 11: Testing Your Procedures, Revisited
=============================================================

* Continue partners!
* Quiz day is food day.

_Overview_

* Preliminaries.
    * Admin.
    * Upcoming Work.
    * Extra Credit.
    * Questions.
    * Quiz.
* Lab.
* Key ideas in testing.
* Careful postconditions.
* Exhaustive testing.
* Making yourself more efficient.

Preliminaries
-------------

### Admin

* Mentor session Monday at 7:00 p.m.
* Friday PSA.
* We'll try to to keep quizzes closer to ten minutes today.
* The last fifteen minutes of today's class will be debriefing.
* My life is complicated next week.  We have a candidate on campus on Monday
  and I'm coaching the middle school MATHCOUNTS team all day Tuesday.  I'll
  be available via email, but probably not in person, for a lot of the day.  
  (I'll be in my office Monday at 11:00 and at 3:15, but not other times.)

### Upcoming Work

* [Exam 1](../assignments/exam.01.html).
    * Required prologue due TONIGHT.
    * Exam due in electronic form next Tuesday.
    * Exam due in printed form next Wednesday.
    * Required epilogue due next Wednesday night.
    * You may have an extra day to do the exam because of my
      limited availability early next week.
* Lab writeup for lab 10, due Monday, Problem 9
  <http://bit.ly/151-2015S-lab10>
* Reading for Monday:
    * [Design and Color](../readings/design-and-color-reading.html)

### Extra Credit Opportunities

#### Academic 

* TEDx Grinnell, sometime in February.

#### Miscellaneous

* Read and comment on the new _Grinnell College Guide to Preventing,
  Reporting, and Responding to Sexual Harassment and Sexual 
  Misconduct_

#### Peer Support (Afternoon Section)

* Track and Field, Saturday at 10 a.m., the Bear Fieldhouse
  (800 is the best race)
* Men's Basketball, Saturday at 3:00 p.m., New Darby
* Swimming, Conference Championships, February 13-15, The Osgood

### Questions

_I've spent twenty minutes on this problem and I'm not making any more
 progress.  Will I get I partial credit?_

> Ask questions after ten!  Ask questions after twenty!

_I'm not sure if I can ask you this, but ..._

> Be sure.  You can.

### Quiz

* When you finish the quiz, start working on your lab.  Your partner
  will catch up.

Lab
---

* We'll stop with about fifteen minutes to go so that we can debrief.
* What does `test-case` do?
        (test-case
         "Description of test"
         statement1
         statement2
         ...
         statementn)
    * Evaluate each statement in turn.
    * If any of the statements fails (reports an error), prints
      the description.
    * If none of the statements reports an error, prints nothing

Key ideas in testing
--------------------

* Tests need to be broad to catch different perspectives on what a
  procedure is supposed to do.
* Good postconditions can lead to good tests (and vice versa)
* It's hard to come up with good postconditions and good tests.
* It's nice to be able to look at the code to write tests, so it's
  even harder because we don't have access to that code.
* Try to write clear tests and clear code.
* If a test fails, it may be an incorrect test rather than incorrect code.
* Think carefully about your tests: You should test for different things.

Careful postconditions
----------------------

* (drawing-center-x result) = x
* (drawing-center-y result) = y
* You want the same shape that you input.  If you started with a square,
  you want a square.  If you strated with a circle, you want a circle.
* You want it the same size/dimensions

Exhaustive testing
------------------

* Test shifting left and right and up and down
* Different shapes: circle, squares, non-square rectangles, non-circular
  ellipses, compound drawings
* Think about edge/corner cases: 0
* Think about weird variants: Negative targets, integer/rational, exact/inexact
* A good test suite is not small.

Making yourself more efficient
------------------------------

