File tree 2 files changed +5
-5
lines changed
2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 39
39
(for [i (range line-count)]
40
40
(format " %02X" (byte-at data (+ offset i)))))))
41
41
42
- (defn format-byte-data
42
+ (defn format-binary
43
43
" Formats a ByteData into a hex-dump string, consisting of multiple lines; each line formatted as:
44
44
45
45
0000: 4E 6F 77 20 69 73 20 74 68 65 20 74 69 6D 65 20 66 6F 72 20 61 6C 6C 20 67 6F 6F 64 20 6D 65 6E
98
98
(format-byte-deltas ansi/bold-green true offset expected-length expected actual-length actual)
99
99
(format-byte-deltas ansi/bold-red false offset actual-length actual expected-length expected))))
100
100
101
- (defn format-byte -delta
101
+ (defn format-binary -delta
102
102
" Formats a hex dump of the expected data (on the left) and actual data (on the right). Bytes
103
103
that do not match are highlighted in green on the expected side, and red on the actual side.
104
104
When one side is shorter than the other, it is padded with -- placeholders to make this
Original file line number Diff line number Diff line change 4
4
clojure.test))
5
5
6
6
(defn- format-string-as-byte-array [str]
7
- (format-byte-data (.getBytes str)))
7
+ (format-binary (.getBytes str)))
8
8
9
9
(deftest format-byte-array-test
10
10
17
17
18
18
(deftest format-string-as-byte-data
19
19
(are [input output]
20
- (= (format-byte-data input) output)
20
+ (= (format-binary input) output)
21
21
" " " "
22
22
" Hello" " 0000: 48 65 6C 6C 6F\n "
23
23
" This is a longer text that spans to a second line."
24
24
" 0000: 54 68 69 73 20 69 73 20 61 20 6C 6F 6E 67 65 72 20 74 65 78 74 20 74 68 61 74 20 73 70 61 6E 73\n 0020: 20 74 6F 20 61 20 73 65 63 6F 6E 64 20 6C 69 6E 65 2E\n " ))
25
25
26
26
(deftest nil-is-an-empty-data
27
- (is (= (format-byte-data nil ) " " )))
27
+ (is (= (format-binary nil ) " " )))
You can’t perform that action at this time.
0 commit comments