struct ptr test [broken]

main
Matthew Butterick 6 years ago
parent f2e50859db
commit 6e7b8529f4

@ -3,6 +3,7 @@
"../helper.rkt" "../helper.rkt"
"../struct.rkt" "../struct.rkt"
"../string.rkt" "../string.rkt"
"../pointer.rkt"
"../number.rkt" "../number.rkt"
sugar/unstable/dict) sugar/unstable/dict)
@ -44,13 +45,12 @@ https://github.com/mbutterick/restructure/blob/master/test/Struct.coffee
'age uint8)) 'age uint8))
(hasheq 'name "roxyb" 'age 32)) 7)) (hasheq 'name "roxyb" 'age 32)) 7))
;; todo: reinstate pointer test (test-case
#;(test-case
"compute the correct size with pointers" "compute the correct size with pointers"
(check-equal? (size (+xstruct (dictify (check-equal? (size (+xstruct (dictify
'name (+xstring uint8) 'name (+xstring uint8)
'age uint8 'age uint8
'ptr (+Pointer uint8 (+xstring uint8)))) 'ptr (+xpointer uint8 (+xstring uint8))))
(mhash 'name "roxyb" 'age 21 'ptr "hello")) 14)) (mhash 'name "roxyb" 'age 21 'ptr "hello")) 14))
(test-case (test-case
@ -79,12 +79,11 @@ https://github.com/mbutterick/restructure/blob/master/test/Struct.coffee
(encode struct (mhasheq 'name "roxyb" 'age 21)) (encode struct (mhasheq 'name "roxyb" 'age 21))
(check-equal? (dump (current-output-port)) #"\x05roxyb\x15"))) (check-equal? (dump (current-output-port)) #"\x05roxyb\x15")))
;; todo: reinstate pointer test (test-case
#;(test-case
"encode pointer data after structure" "encode pointer data after structure"
(parameterize ([current-output-port (open-output-bytes)]) (parameterize ([current-output-port (open-output-bytes)])
(define struct (+xstruct (dictify 'name (+xstring uint8) (define struct (+xstruct (dictify 'name (+xstring uint8)
'age uint8 'age uint8
'ptr (+Pointer uint8 (+xstring uint8))))) 'ptr (+xpointer uint8 (+xstring uint8)))))
(encode struct (hasheq 'name "roxyb" 'age 21 'ptr "hello")) (encode struct (hasheq 'name "roxyb" 'age 21 'ptr "hello"))
(check-equal? (dump (current-output-port)) #"\x05roxyb\x15\x08\x05hello"))) (check-equal? (dump (current-output-port)) #"\x05roxyb\x15\x08\x05hello")))
Loading…
Cancel
Save