Question & Answer: I wanted to run tests/check-expects for the code below in bold but I do not remember how to impement them. Ca…..

I wanted to run tests/check-expects for the code below in bold but I do not remember how to impement them. Can someone let me know how to run tests in Racket and show me an example?

#lang eopl

(require test-engine/racket-tests)

;Purpose: returns root of bst
(define(get-root bst)(car bst))

;Purpose: returns left subtree
(define(get-lst bst)(cadr bst))

;Purpose: returns right subtree
(define(get-rst bst)(caddr bst))

;path n bst –> cons left or right
;Purpose: if the root value is equal to n, the search is completed so return null
;Purpose: if the root value is less than n, then search in the right subtree, add “right” to the path, and call the path function on the right subtree
;Purpose: if the root value is greater than n, then search in the right subtree, add “left” to the path, and call the path function on the left subtree
(define (path n bst)
(cond [(= n (get-root bst)) ‘()]
[(< n (get-root bst)) (cons “left” (path n (get-lst bst))) ]
[(> n (get-root bst)) (cons “right” (path n (get-rst bst)))]))

;check-expects

Expert Answer

 

Still stressed from student homework?
Get quality assistance from academic writers!