Functional Problem Solving (CSC 151 2015F) : EBoards

CSC151.02 2015F, Class 13: Testing Your Procedures, Revisited


Overview

Preliminaries

Admin

Upcoming Work

Extra Credit Opportunities

Academic

Peer Support

Questions

Can I use <> multiple times in section?

Yes. Each is treated as a separate input.

You probably won't want to do this with one call to section on problem 1.

Composition is your friend.

I feel like I saw something really like problem 2 somewhere. Can you tell me where?

Homework assignment 3.

Do we have homework in addition to the exam?

No!

How should we provide examples?

Write in interactions pane. Copy, paste, comment out with semicolons.

What should we do if something says "the highest component of a color" and two components are equally large, such as (irgb 200 0 200).

Option 1: It's up to you which of the largest components you use.

Option 2: Good specifications - Failed to meet preconditions - Whatever you want.

What should we do if people don't meet the preconditions?

If you say that the preconditions are "verified", you must issue an error message.

If you say that the preconditions are "unverified" (or you don't say anything about their being verified), the assumption is that youre procedure can do anything if they are not met.

Should that question help me think about problem 2?

Probably.

Key ideas in testing

Testing Exercise

What tests would you write for the following procedure?

;;; Procedure:
;;;   classify-triangle
;;; Parameters:
;;;   side1, a rational number [unverified]
;;;   side2, a rational number [unverified]
;;;   side3, a rational number [unverified]
;;; Purpose:
;;;   Determine the kind of triangle the three sides describe.
;;; Produces:
;;;   classification, a string 
;;; Preconditions:
;;;   side1, side2, and side3 together describe a triangle [verified]
;;; Postconditions:
;;;   If all three sides are equal, classification is "equilateral".
;;;   If exactly two sides are equal, classification is "isosceles".
;;;   If no two sides are equal, classification is "scalene".

Finish Lab