testing - Rackunit equality-checking for structs -



testing - Rackunit equality-checking for structs -

i'm trying test out tokenizer/parser combo compiler in racket, , have function parse-string, contract-typed (-> string? ast:intexp) (i know, should rename structs, experimenting typed racket little while there. anyway, have test bank written stuff (check-equal? (parse-string "4") (ast:intexp 4)), , of tests fail, though upon manual inspection, ought pass. of structs defined define-struct/contract, , of them marked #:transparent. what's going wrong here?

okay, sorry not including plenty source helpful:

here's struct definition intexp: (define-struct/contract (intexp exp) ([val integer?]) #:transparent) here's test: (check-equal? (parse-string "4") (ast:intexp 4)) here's complaint rackunit gives back:

-------------------- failure actual: #(struct:intexp ... 4) expected: #(struct:intexp ... 4) name: check-equal? location: (#<path:/users/clem/dev/tiger/parser-lexer-tests.rkt> 8 0 139 48) expression: (check-equal? (parse-string "4") (ast:intexp 4)) and, in case, here's dependencies i'm requireing:

(require "lexer.rkt" "parser.rkt" parser-tools/lex (prefix-in ast: "ast.rkt") rackunit)

the actual parser code kind of large, , have hunch it's not source of problem, because of tests failing in way (the results, upon inspection, seem correct). bet i'm doing silly in rackunit.

racket using reference-equality because structs in question inherited opaque struct-type. per the docs, either create opaque parent structs transparent, or add together equal?-recur method compares underlying structure.

testing scheme racket

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -