-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use java.util.Base64 instead of BASE64Encoder
For backwards/forwards compatibility between implementations, adds a trailing newline to the string to match the behaviour of the sun.misc.BASE64Decoder. This effectively sets the minimum JVM to Java 8, at least to use this namespace.
- Loading branch information
1 parent
3e5259f
commit fdf4463
Showing
3 changed files
with
40 additions
and
3 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
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
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 |
---|---|---|
@@ -1,9 +1,27 @@ | ||
(ns flatland.useful.compress-test | ||
(:use clojure.test flatland.useful.compress)) | ||
(:use clojure.test | ||
flatland.useful.compress) | ||
(:require [clojure.test.check.clojure-test :refer [defspec]] | ||
[clojure.test.check.generators :as gen] | ||
[clojure.test.check.properties :as prop])) | ||
|
||
|
||
(deftest round-trip | ||
(let [s "f3509ruwqerfwoa reo1u30`1 ewf dfgjdsf sfc saf65sad+ f5df3 | ||
g2 sd35g4szdf sdf4 as89faw76fwfwf210 | ||
"] | ||
(is (= s (unsmash (smash s)))))) | ||
|
||
(deftest smash-test | ||
(is (= "eJwDAAAAAAE=\n" (smash-new ""))) | ||
(is (= "eJxLBAAAYgBi\n" (smash-new "a")))) | ||
|
||
(deftest unsmash-test | ||
(is (= "" (unsmash-new "eJwDAAAAAAE=\n"))) | ||
(is (= "a" (unsmash-new "eJxLBAAAYgBi\n")))) | ||
|
||
(defspec round-trip-gen | ||
100 | ||
(prop/for-all [s gen/string] | ||
(println s) | ||
(= s (unsmash-new (smash s))))) |