Skip to content

Commit

Permalink
Rename functions
Browse files Browse the repository at this point in the history
  • Loading branch information
hlship committed Oct 23, 2013
1 parent b3e7d41 commit c73935d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/io/aviso/binary.clj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
(for [i (range line-count)]
(format " %02X" (byte-at data (+ offset i)))))))

(defn format-byte-data
(defn format-binary
"Formats a ByteData into a hex-dump string, consisting of multiple lines; each line formatted as:
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
Expand Down Expand Up @@ -98,7 +98,7 @@
(format-byte-deltas ansi/bold-green true offset expected-length expected actual-length actual)
(format-byte-deltas ansi/bold-red false offset actual-length actual expected-length expected))))

(defn format-byte-delta
(defn format-binary-delta
"Formats a hex dump of the expected data (on the left) and actual data (on the right). Bytes
that do not match are highlighted in green on the expected side, and red on the actual side.
When one side is shorter than the other, it is padded with -- placeholders to make this
Expand Down
6 changes: 3 additions & 3 deletions test/io/aviso/binary_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
clojure.test))

(defn- format-string-as-byte-array [str]
(format-byte-data (.getBytes str)))
(format-binary (.getBytes str)))

(deftest format-byte-array-test

Expand All @@ -17,11 +17,11 @@

(deftest format-string-as-byte-data
(are [input output]
(= (format-byte-data input) output)
(= (format-binary input) output)
"" ""
"Hello" "0000: 48 65 6C 6C 6F\n"
"This is a longer text that spans to a second line."
"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\n0020: 20 74 6F 20 61 20 73 65 63 6F 6E 64 20 6C 69 6E 65 2E\n"))

(deftest nil-is-an-empty-data
(is (= (format-byte-data nil) "")))
(is (= (format-binary nil) "")))

0 comments on commit c73935d

Please sign in to comment.