[plt-scheme] HTDP: Testing programs
Shriram's saying that the design recipe demands the creation of
examples *before* you create the function. The idea is that this
scales up to larger development efforts, too.
In principle, a design looks like this:
;; f->c : Number -> Number
;; convert a fahrenheit temperature to a celsius temperature
(check-expect (f->c 32) 0)
(check-expect (f->c 212) 100)
(define (f->c f-temp)
(cond
[(= f-temp 32) 0]
[(= f-temp 212) 100]
[else f-temp]))
;; ---
Over the years, HtDP and drscheme have gotten a bit out of hand. One
day we'll catch up. -- Matthias
On Aug 27, 2008, at 7:19 AM, Shriram Krishnamurthi wrote:
> The intent is that you write test cases *before* you
> write your functions. If you had done this, and your
> test cases covered your program, DrScheme would
> not complain at you. Bad boy! (-:
>
> Shriram
>
> On Tue, Aug 26, 2008 at 11:39 PM, Grant Rettke <grettke at acm.org>
> wrote:
>> Hi folks,
>>
>> In HTDP beginner language on problem 2.2.1, when I evaluate it,
>> DrScheme complains that "This program should be tested".
>>
>> is the intention that students start testing immediately, or we ill
>> add tests later on?
>>
>> I used check-expect for now.
>>
>> Best wishes,
>>
>> Grant
>> _________________________________________________
>> For list-related administrative tasks:
>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme