summaryrefslogtreecommitdiff
path: root/ebus-racket/layer2-test.rkt
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2012-02-26 19:49:39 +0100
committerYves Fischer <yvesf-git@xapek.org>2012-02-26 19:49:39 +0100
commit36f42916cadd07bba5d0812566fba4546641cde9 (patch)
tree761cf941f01d36051e7582c9b863c44fffae5473 /ebus-racket/layer2-test.rkt
parent0ebb35c9dbd4853924ec4124862eb26bc45b9f12 (diff)
downloadebus-alt-36f42916cadd07bba5d0812566fba4546641cde9.tar.gz
ebus-alt-36f42916cadd07bba5d0812566fba4546641cde9.zip
ebus-racked: rename to layer2-/layer7-
Diffstat (limited to 'ebus-racket/layer2-test.rkt')
-rw-r--r--ebus-racket/layer2-test.rkt41
1 files changed, 41 insertions, 0 deletions
diff --git a/ebus-racket/layer2-test.rkt b/ebus-racket/layer2-test.rkt
new file mode 100644
index 0000000..ed20ca6
--- /dev/null
+++ b/ebus-racket/layer2-test.rkt
@@ -0,0 +1,41 @@
+#lang racket
+(require rackunit
+ rackunit/text-ui
+ "layer2.rkt")
+
+(define layer2-test
+ (test-suite
+ "Tests for Ebus Parser"
+ (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)))])
+ (check-eq? (layer2-ebus-paket-source paket) 003)
+ (check-eq? (layer2-ebus-paket-destination paket) 241)
+ (check-eq? (layer2-ebus-paket-primaryCommand paket) 008)
+ (check-eq? (layer2-ebus-paket-secondaryCommand paket) 000)
+ (check-eq? (layer2-ebus-paket-payloadLength paket) 008)
+ (check-eq? (layer2-ebus-paket-payloadLength paket)
+ (length (layer2-ebus-paket-payload paket)))
+ ))))
+
+(run-tests layer2-test)