-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
(ns cljam.io.cram.itf8-test | ||
(:require [cljam.io.cram.itf8 :as itf8] | ||
[cljam.io.util.byte-buffer :as bb] | ||
[clojure.test :refer [deftest are]])) | ||
|
||
(deftest decode-itf8-test | ||
(are [bs expected] (= expected | ||
(-> (byte-array bs) | ||
bb/make-lsb-byte-buffer | ||
itf8/decode-itf8)) | ||
[0x00] 0x00 | ||
[0x7f] 0x7f | ||
[0x80 0xff] 0xff | ||
[0xbc 0xab] 0x3cab | ||
[0xc0 0x12 0x34] 0x1234 | ||
[0xda 0xbc 0x23] 0x1abc23 | ||
[0xe0 0x12 0x34 0x56] 0x123456 | ||
[0xea 0xbc 0xde 0xf0] 0xabcdef0 | ||
[0xfc 0xaf 0xeb 0xab 0x0e] (unchecked-int 0xcafebabe) | ||
[0xff 0xff 0xff 0xff 0xff] -1)) | ||
|
||
(deftest decode-ltf8-test | ||
(are [bs expected] (= expected | ||
(-> (byte-array bs) | ||
bb/make-lsb-byte-buffer | ||
itf8/decode-ltf8)) | ||
[0x00] 0x00 | ||
[0x7f] 0x7f | ||
[0x80 0xff] 0xff | ||
[0xbc 0xab] 0x3cab | ||
[0xc0 0x12 0x34] 0x1234 | ||
[0xda 0xbc 0x23] 0x1abc23 | ||
[0xe0 0x12 0x34 0x56] 0x123456 | ||
[0xea 0xbc 0xde 0xf0] 0xabcdef0 | ||
[0xf0 0xde 0xad 0xbe 0xef] 0xdeadbeef | ||
[0xf7 0xff 0xff 0xff 0xff] 0x7ffffffff | ||
[0xf8 0x12 0x34 0x56 0x78 0x9a] 0x123456789a | ||
[0xfb 0xff 0xff 0xff 0xff 0xff] 0x3ffffffffff | ||
[0xfc 0xba 0xdb 0xad 0xba 0xdb 0xad] 0xbadbadbadbad | ||
[0xfd 0x23 0x45 0x67 0x89 0xab 0xcd] 0x123456789abcd | ||
[0xfe 0x12 0x34 0x56 0x78 0x9a 0xbc 0xde] 0x123456789abcde | ||
[0xfe 0xff 0xff 0xff 0xff 0xff 0xff 0xff] 0xffffffffffffff | ||
[0xff 0x12 0x34 0x56 0x78 0x9a 0xbc 0xde 0xf0] 0x123456789abcdef0 | ||
[0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff] -1)) |