Permalink
Cannot retrieve contributors at this time
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?
CSE1729-Mimir-Testing-Scripts/genericTester.scm
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
56 lines (47 sloc)
2.28 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 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 reference-solution-file (read (current-input-port))) | |
(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))) | |
(define test-assertion (read (current-input-port))) | |
(define show-reference-output (read (current-input-port))) | |
(define show-test-call (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)))) | |
(if (eval show-test-call (interaction-environment)) | |
(begin (display "Running: (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 reference-solution-file) | |
(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) |