diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2012-02-28 22:38:10 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2012-02-28 22:38:10 +0100 |
commit | 494ed088e84b92af85d2f7260d242b06615fab69 (patch) | |
tree | 856624819962ebf8ac072e377fb639e536c0f0c7 /ebus-racket/layer7-test.rkt | |
parent | 36f42916cadd07bba5d0812566fba4546641cde9 (diff) | |
download | ebus-alt-494ed088e84b92af85d2f7260d242b06615fab69.tar.gz ebus-alt-494ed088e84b92af85d2f7260d242b06615fab69.zip |
ebus-racket: layer7: parse bit,data1b,data2b
Diffstat (limited to 'ebus-racket/layer7-test.rkt')
-rw-r--r-- | ebus-racket/layer7-test.rkt | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/ebus-racket/layer7-test.rkt b/ebus-racket/layer7-test.rkt new file mode 100644 index 0000000..9654f06 --- /dev/null +++ b/ebus-racket/layer7-test.rkt @@ -0,0 +1,46 @@ +#lang racket +(require rackunit + rackunit/text-ui + "layer2.rkt" + "layer7.rkt") + +(define layer7-test + (test-suite + "Tests for Ebus Layer 7 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 + 200 ; p5 + 002 ; p6 + 000 ; p7 + 010 ; p8 + 128 ; CRC + 000 ; ACK + 170 ; SYN + 170)))] + [fields (layer7-paket-fields paket)]) + (check-true (= 5 (length fields)) "Anzahl der gelesenen Felder") + (for ([field fields]) + (display field) + (display "\n") + (cond ((= (list-ref field 2) 0) (check-equal? (list-ref field 3) 40.5 "Wert TK_soll")) + ((= (list-ref field 2) 2) (check-equal? (list-ref field 3) 2.8984375 "Wert TA_ist")) + ((= (list-ref field 2) 4) (check-equal? (list-ref field 3) 200 "Wert L_zwang")) + ((= (list-ref field 2) 5) (check-equal? (list-ref field 3) 0 "Wert Status")) + ((= (list-ref field 2) 6) (check-equal? (list-ref field 3) 10 "Wert TB_soll")))))) ;end test-case + )) + + +(run-tests layer7-test)
\ No newline at end of file |