Commit 1a142b2a authored by Dan Holtby's avatar Dan Holtby
Browse files

add tests

parent 0e1e9abb
...@@ -9,3 +9,6 @@ ...@@ -9,3 +9,6 @@
(define pkg-desc "Wrapper for racket/trace that allows it to be used in Beginning Student (HtDP)") (define pkg-desc "Wrapper for racket/trace that allows it to be used in Beginning Student (HtDP)")
(define version "1.2") (define version "1.2")
(define pkg-authors '(djholtby)) (define pkg-authors '(djholtby))
(define test-include-paths '("tests/main.rkt"))
(define test-omit-paths '("tests/bsl-test.rkt" "tests/isl-test.rkt"))
\ No newline at end of file
;; The first three lines of this file were inserted by DrRacket. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-beginner-reader.ss" "lang")((modname bsl-test) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
(require "../main.rkt")
(define/trace (f lst)
(cond [(empty? lst) 0]
[else (+ (first lst) (f (rest lst)))]))
(f (list 1 2 3))
;; The first three lines of this file were inserted by DrRacket. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname isl-test) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
(require "../main.rkt")
(define/trace (f lst)
(local [(define/trace (g x y) (+ x y))]
(cond [(empty? lst) 0]
[else (g (first lst) (f (rest lst)))])))
(f (list 1 2 3))
#lang racket/base
(require rackunit)
(define bsl-output (open-output-string))
(parameterize ([current-output-port bsl-output])
(dynamic-require "bsl-test.rkt" #f))
(check-equal? (get-output-string bsl-output) #<<EXPECTED
>(f '(1 2 3))
> (f '(2 3))
> >(f '(3))
> > (f '())
< < 0
< <3
< 5
<6
6
EXPECTED
)
(define isl-output (open-output-string))
(parameterize ([current-output-port isl-output])
(dynamic-require "isl-test.rkt" #f))
(check-equal? (get-output-string isl-output) #<<EXPECTED
>(f '(1 2 3))
> (f '(2 3))
> >(f '(3))
> > (f '())
< < 0
> >(g 3 0)
< <3
> (g 2 3)
< 5
>(g 1 5)
<6
6
EXPECTED
)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment