From e01f36c90c19ddf52c4c3b2f9d14f1fb52349c4a Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Sun, 26 Feb 2012 18:34:22 +0100 Subject: ebus-racket: simple unittest --- ebus-racket/parser.rkt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'ebus-racket/parser.rkt') diff --git a/ebus-racket/parser.rkt b/ebus-racket/parser.rkt index 1b9ed5b..51b9b55 100644 --- a/ebus-racket/parser.rkt +++ b/ebus-racket/parser.rkt @@ -19,7 +19,7 @@ (crc payloadSlaveLength payloadSlave crcSlave) #:transparent) -(struct ebus-paket (header body) #:transparent) +(struct ebus-paket (header payload body) #:transparent) (define parse-ebus-header (token (seq source <- any-byte destination <- any-byte @@ -64,7 +64,7 @@ payload <- (repeat ebus-payload (ebus-header-payloadLength header) (ebus-header-payloadLength header)) body <- (cond ((= (ebus-header-destination header) ebus-const-broadcastaddr) parse-ebus-broadcast) (else parse-ebus-master-or-slave)) - (return (ebus-paket header body))))) + (return (ebus-paket header payload body))))) (define ebus-sync (tokens syncs <- (seq (repeat (string->bytes/latin-1 "\xaa"))) (return (length syncs)))) @@ -95,4 +95,9 @@ (cond ((not (eof-object? paket)) (read-ebus-loop input-port))))) (provide read-ebus - read-ebus-loop) \ No newline at end of file + read-ebus-loop + (struct-out ebus-paket) + (struct-out ebus-header) + (struct-out ebus-body-broadcast) + (struct-out ebus-body-mastermaster) + (struct-out ebus-body-masterslave)) \ No newline at end of file -- cgit v1.2.1