File tree Expand file tree Collapse file tree 3 files changed +55
-89
lines changed
Expand file tree Collapse file tree 3 files changed +55
-89
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ (ns zlib-tiny.checksum
2+ (:require [clojure.test :refer :all ]
3+ [zlib-tiny.core :refer :all ])
4+ (:import (org.apache.commons.codec.binary Hex)))
5+
6+ (def test-string " test it!" )
7+
8+ (deftest checksums
9+ (testing " CRC32"
10+ (is (= 3421780262 (crc32 (.getBytes " 123456789" )))))
11+ (testing " CRC64"
12+ (is (= -7395533204333446662 (crc64 (.getBytes " 123456789" ))))))
13+
14+ (deftest digests
15+ (testing " MD5"
16+ (is (= " f4214812f0247f69661fd29e0fca6496" (-> test-string
17+ str->bytes
18+ md5
19+ Hex/encodeHex
20+ (String. )))))
21+ (testing " SHA1"
22+ (is (= " 1393ce5dfcf39109a420eb583ecfdeacc28c783a"
23+ (-> test-string
24+ str->bytes
25+ sha-1
26+ Hex/encodeHex
27+ (String. )))))
28+ (testing " SHA256"
29+ (is (= " 9c507d01834b2749d088122a7b3d200957f9b25579b5ce6b490e3b2067ee4f66"
30+ (-> test-string
31+ str->bytes
32+ sha-256
33+ Hex/encodeHex
34+ (String. ))))))
Original file line number Diff line number Diff line change 1+ (ns zlib-tiny.compress
2+ (:require [clojure.test :refer :all ]
3+ [zlib-tiny.core :refer :all ]))
4+
5+ (def test-string " test it!" )
6+
7+ (deftest compressors
8+ (testing " Checking ZLib"
9+ (is (= test-string (-> test-string
10+ str->bytes
11+ deflate
12+ inflate
13+ force-byte-array
14+ bytes->str))))
15+
16+ (testing " Checking GZip"
17+ (is (= test-string (-> test-string
18+ str->bytes
19+ gzip
20+ gunzip
21+ bytes->str)))))
You can’t perform that action at this time.
0 commit comments