diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2012-03-02 00:25:33 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2012-03-02 00:25:33 +0100 |
commit | 27e06b6e29c92e802a950e7c318daae7b8582f69 (patch) | |
tree | e5c8ec6b2aff4f4087989f496c5510315a7636ec | |
parent | d8baa50b97a98e57d817ee3935c0d203f4acdff1 (diff) | |
download | ebus-alt-27e06b6e29c92e802a950e7c318daae7b8582f69.tar.gz ebus-alt-27e06b6e29c92e802a950e7c318daae7b8582f69.zip |
ebus-racket: *-test: use racket/base, layer2: invalid packet test
-rw-r--r-- | ebus-racket/layer2-test.rkt | 76 | ||||
-rw-r--r-- | ebus-racket/layer7-test.rkt | 4 |
2 files changed, 55 insertions, 25 deletions
diff --git a/ebus-racket/layer2-test.rkt b/ebus-racket/layer2-test.rkt index ed20ca6..326725d 100644 --- a/ebus-racket/layer2-test.rkt +++ b/ebus-racket/layer2-test.rkt @@ -1,4 +1,4 @@ -#lang racket +#lang racket/base (require rackunit rackunit/text-ui "layer2.rkt") @@ -9,26 +9,28 @@ (test-case "Test sample Master-Master Paket" (let - ([paket (layer2-read-ebus (open-input-bytes (bytes - 170 ; SYN - 170 - 003 ; Source - 241 ; Destination - 008 ; primaryCommand - 000 ; secondaryCommand - 008 ; payloadLength - 128 ; p1 - 040 ; p2 - 230 ; p3 - 002 ; p4 - 000 ; p5 - 002 ; p6 - 000 ; p7 - 010 ; p8 - 128 ; CRC - 000 ; ACK - 170 ; SYN - 170)))]) + ([paket (layer2-read-ebus + (open-input-bytes + (bytes + 170 ; SYN + 170 + 003 ; Source + 241 ; Destination + 008 ; primaryCommand + 000 ; secondaryCommand + 008 ; payloadLength + 128 ; p1 + 040 ; p2 + 230 ; p3 + 002 ; p4 + 000 ; p5 + 002 ; p6 + 000 ; p7 + 010 ; p8 + 128 ; CRC + 000 ; ACK + 170 ; SYN + 170)))]) (check-eq? (layer2-ebus-paket-source paket) 003) (check-eq? (layer2-ebus-paket-destination paket) 241) (check-eq? (layer2-ebus-paket-primaryCommand paket) 008) @@ -36,6 +38,34 @@ (check-eq? (layer2-ebus-paket-payloadLength paket) 008) (check-eq? (layer2-ebus-paket-payloadLength paket) (length (layer2-ebus-paket-payload paket))) - )))) + )) + (test-case + "test invalid paket" + (let + ([paket (layer2-read-ebus + (open-input-bytes + (bytes + 170 ;SYN + 170 ;SYN + 016 ;SRC + 003 ;DEST + 008 ;PRIM => sollwertuebertragungRegler + 000 ;SEC => sollwertuebertragungRegler + 008 ;PAY + 051 ;P1 + 042 ;P2 + 000 ;P3 + 009 ;P4 + 128 ;P5 + 019 ;P6 + 000 ;P7 | ACK + 045 ;P8 | ??? + 170 ;SYN + 170 ;SYN + )))]) + (check-eq? paket eof) + )) + )) + -(run-tests layer2-test) +(exit (run-tests layer2-test))
\ No newline at end of file diff --git a/ebus-racket/layer7-test.rkt b/ebus-racket/layer7-test.rkt index 9654f06..2099bf8 100644 --- a/ebus-racket/layer7-test.rkt +++ b/ebus-racket/layer7-test.rkt @@ -1,4 +1,4 @@ -#lang racket +#lang racket/base (require rackunit rackunit/text-ui "layer2.rkt" @@ -43,4 +43,4 @@ )) -(run-tests layer7-test)
\ No newline at end of file +(exit (run-tests layer7-test))
\ No newline at end of file |