Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler-tests-suite cannot check answers for self-defined var_test (unless the real answer is 42) #20

Open
rundong08 opened this issue Nov 17, 2022 · 0 comments

Comments

@rundong08
Copy link

Description

When you have self defined var_test cases, for example, a var_test_4.rkt file with simple content

43

and when you run racket run-tests.rkt, it will generate error like

--------------------
var_test_4 > compiler tests > code generation
FAILURE
name:       check
location:   utilities.rkt:2275:46
params:     '(#<procedure:result-check> 43 "42")
message:    "Mismatched output from x86 execution"
--------------------

Expected Behavior (assuming your compiler implementation is correct)

All tests should pass

Cause

compiler-tests-suite expect to read the expected output from some .res file, for examplevar_test_4.res, otherwise it will assume the expected output should be 42.

Workaround

In the check-passes-suite function, add the following before (let loop ([passes passes]

 (cond [initial-interp
              (with-output-to-file result-file-name #:exists 'replace
                (lambda () (printf "~a" expected-result)))])

This will write the expected output to the corresponding result file in the interpreter run (before the compiler run).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant