|
|
|
@ -98,7 +98,7 @@ https://github.com/mbutterick/restructure/blob/master/test/Pointer.coffee
|
|
|
|
|
"pointer: encode should handle null pointers"
|
|
|
|
|
(parameterize ([current-output-port (open-output-bytes)])
|
|
|
|
|
(define parent (mhash x:pointer-size-key 0
|
|
|
|
|
x:alt-start-offset-key 0
|
|
|
|
|
x:start-offset-key 0
|
|
|
|
|
x:pointer-offset-key 0
|
|
|
|
|
x:pointers-key null))
|
|
|
|
|
(encode (x:pointer) #f #:parent parent)
|
|
|
|
@ -109,7 +109,7 @@ https://github.com/mbutterick/restructure/blob/master/test/Pointer.coffee
|
|
|
|
|
"pointer: encode should handle local offsets"
|
|
|
|
|
(parameterize ([current-output-port (open-output-bytes)])
|
|
|
|
|
(define parent (mhash x:pointer-size-key 0
|
|
|
|
|
x:alt-start-offset-key 0
|
|
|
|
|
x:start-offset-key 0
|
|
|
|
|
x:pointer-offset-key 1
|
|
|
|
|
x:pointers-key null))
|
|
|
|
|
(encode (x:pointer) 10 #:parent parent)
|
|
|
|
@ -123,7 +123,7 @@ https://github.com/mbutterick/restructure/blob/master/test/Pointer.coffee
|
|
|
|
|
"pointer: encode should handle immediate offsets"
|
|
|
|
|
(parameterize ([current-output-port (open-output-bytes)])
|
|
|
|
|
(define parent (mhash x:pointer-size-key 0
|
|
|
|
|
x:alt-start-offset-key 0
|
|
|
|
|
x:start-offset-key 0
|
|
|
|
|
x:pointer-offset-key 1
|
|
|
|
|
x:pointers-key null))
|
|
|
|
|
(encode (x:pointer #:relative-to 'immediate) 10 #:parent parent)
|
|
|
|
@ -137,7 +137,7 @@ https://github.com/mbutterick/restructure/blob/master/test/Pointer.coffee
|
|
|
|
|
"pointer: encode should handle offsets relative to parent"
|
|
|
|
|
(parameterize ([current-output-port (open-output-bytes)])
|
|
|
|
|
(define parent (mhash x:parent-key (mhash x:pointer-size-key 0
|
|
|
|
|
x:alt-start-offset-key 3
|
|
|
|
|
x:start-offset-key 3
|
|
|
|
|
x:pointer-offset-key 5
|
|
|
|
|
x:pointers-key null)))
|
|
|
|
|
(encode (x:pointer #:relative-to 'parent) 10 #:parent parent)
|
|
|
|
@ -153,7 +153,7 @@ https://github.com/mbutterick/restructure/blob/master/test/Pointer.coffee
|
|
|
|
|
(define parent (mhash x:parent-key
|
|
|
|
|
(mhash x:parent-key
|
|
|
|
|
(mhash x:parent-key (mhash x:pointer-size-key 0
|
|
|
|
|
x:alt-start-offset-key 3
|
|
|
|
|
x:start-offset-key 3
|
|
|
|
|
x:pointer-offset-key 5
|
|
|
|
|
x:pointers-key null)))))
|
|
|
|
|
(encode (x:pointer #:relative-to 'global) 10 #:parent parent)
|
|
|
|
@ -168,7 +168,7 @@ https://github.com/mbutterick/restructure/blob/master/test/Pointer.coffee
|
|
|
|
|
"pointer: encode should support void pointers"
|
|
|
|
|
(parameterize ([current-output-port (open-output-bytes)])
|
|
|
|
|
(define parent (mhash x:pointer-size-key 0
|
|
|
|
|
x:alt-start-offset-key 0
|
|
|
|
|
x:start-offset-key 0
|
|
|
|
|
x:pointer-offset-key 1
|
|
|
|
|
x:pointers-key null))
|
|
|
|
|
(encode (x:pointer uint8 'void) (x:void-pointer uint8 55) #:parent parent)
|
|
|
|
@ -180,7 +180,7 @@ https://github.com/mbutterick/restructure/blob/master/test/Pointer.coffee
|
|
|
|
|
"pointer: encode should throw if not a void pointer instance"
|
|
|
|
|
(parameterize ([current-output-port (open-output-bytes)])
|
|
|
|
|
(define parent (mhash x:pointer-size-key 0
|
|
|
|
|
x:alt-start-offset-key 0
|
|
|
|
|
x:start-offset-key 0
|
|
|
|
|
x:pointer-offset-key 1
|
|
|
|
|
x:pointers-key null))
|
|
|
|
|
(check-exn exn:fail:contract? (λ () (encode (x:pointer uint8 'void) 44 #:parent parent)))))
|
|
|
|
|