summaryrefslogtreecommitdiff
path: root/ebus-racket
diff options
context:
space:
mode:
Diffstat (limited to 'ebus-racket')
-rw-r--r--ebus-racket/layer2-test.rkt76
-rw-r--r--ebus-racket/layer7-test.rkt4
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