array ptr test

main
Matthew Butterick 6 years ago
parent 0f2a613bb4
commit f2e50859db

@ -86,7 +86,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Pointer.coffee
[else (error 'unknown-pointer-style)])]
[(type val) (resolve-void-pointer (xpointer-type xp) val)])
(when (and val ctx)
(dict-set! ctx 'pointerSize (and (dict-ref ctx 'pointerSize)
(dict-set! ctx 'pointerSize (and (dict-ref ctx 'pointerSize #f)
(+ (dict-ref ctx 'pointerSize) (size type val parent)))))
(size (xpointer-offset-type xp))))

@ -3,6 +3,7 @@
"../helper.rkt"
"../array.rkt"
"../number.rkt"
"../pointer.rkt"
sugar/unstable/dict)
#|
@ -85,7 +86,6 @@ https://github.com/mbutterick/restructure/blob/master/test/Array.coffee
"encode length as number before array"
(check-equal? (encode (+xarray uint8 uint8) '(1 2 3 4) #f) (bytes 4 1 2 3 4)))
;; todo: reinstate pointer test
#;(test-case
(test-case
"add pointers after array if length is encoded at start"
(check-equal? (encode (+xarray (+Pointer uint8 uint8) uint8) '(1 2 3 4)) (bytes 4 5 6 7 8 1 2 3 4)))
(check-equal? (encode (+xarray (+xpointer uint8 uint8) uint8) '(1 2 3 4) #f) (bytes 4 5 6 7 8 1 2 3 4)))
Loading…
Cancel
Save