[plt-scheme] Test the Program

From: Jon Rafkind (rafkind at cs.utah.edu)
Date: Wed Sep 2 16:27:11 EDT 2009

Jon Rafkind wrote:
> Asher, Gregg wrote:
>> I apologize if this question has been asked before. I checked the 
>> archives and couldn't find my problem listed.
>>
>> When I define a program in the definitions window and then enter the 
>> program name in the interactive window substituting a value for the 
>> parameter and then "Run" (my version of Dr. Scheme doesn't have an 
>> "Execute" button) the program I don't the results of the program but 
>> a message "This program should be tested.
>>  
>>> "
>>>     
>>
>> For example when I run this program (area-of-disk 3), I get the 
>> message "This program should be tested.
>>  
>>> "
>>>     
>>
>> When I run the same program (area-of-disk 3) in the definitions window
>>
>> I get the correct answer "28.26" in the interactive window.
>>
>> Any help would be appreciated.
>>
>> Dr. Scheme is running off of a flash drive if that makes any 
>> difference. I have 60 programming students and want them to run Dr. 
>> Scheme from the flash drive so that they can run the program from any 
>> computer.
>>
>>   
> I think you just aren't pressing the run button after entering new 
> definitions. Before you can use a new definition in the interactions 
> pane you have to press run.
>
> If thats not the problem maybe you can post some more code?
Ignore that, I you probably just need a 'check-expect' expression to 
test your function in the definitions window.

(define (area-of-circle x)
  (* x x))

(check-expect (area-of-circle 3) 9)

Produces
The test passed!


Posted on the users mailing list.