Skip to content
Permalink
8c24a09027
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
55 lines (46 sloc) 2.23 KB
; If you found this file on Mimir and would like to update it, please submit
; a pull request to:
; https://github.uconn.edu/Brandon/CSE1729-Mimir-Testing-Scripts
(define (testEntry)
(define student-answers-file (read (current-input-port)))
(load "utilities.scm")
(define test-function (read (current-input-port)))
(define test-arguments (read (current-input-port)))
(define test-output-transform (read (current-input-port)))
; test-assertion should be a lambda we can pass student-out and reference-out
; to. Ex: "(lambda (student reference) (< (abs (- student reference)) 0.0001))
(define test-assertion (read (current-input-port)))
(define show-reference-output (read (current-input-port)))
(if (eq? test-output-transform "")
(set! test-output-transform (lambda (x) x))
(set! test-output-transform (eval test-output-transform (interaction-environment))))
; (display "Testing: (apply " (current-error-port))
; (display test-function (current-error-port))
; (display " '" (current-error-port))
; (display (eval test-arguments (interaction-environment)) (current-error-port))
; (display ")\n" (current-error-port))
; Load student solution and grab their answer
(load student-answers-file)
(define student-out
(test-output-transform
(apply (eval test-function (interaction-environment))
(eval test-arguments (interaction-environment)))))
(display "Your output was: " (current-error-port))
(display student-out (current-error-port))
(newline (current-error-port))
; Load our solution and grab our answer.
(load "referenceSolution.scm")
(define reference-out
(test-output-transform
(apply (eval test-function (interaction-environment))
(eval test-arguments (interaction-environment)))))
(if (eval show-reference-output (interaction-environment))
(begin (display "The solution was: " (current-error-port))
(display reference-out (current-error-port))
(newline (current-error-port))))
; Ensure only #t or #f is the last line. This may not be the case if there
; were calls to the display function in the student code.
(newline)
(display ((eval test-assertion (interaction-environment)) student-out reference-out))
(newline))
(testEntry)