2017-05-27 17:56:31 +00:00
|
|
|
module Tests exposing (..)
|
2016-03-12 21:57:00 +00:00
|
|
|
|
2016-08-17 11:14:17 +00:00
|
|
|
import Test exposing (..)
|
|
|
|
import Expect
|
2016-03-27 19:33:51 +00:00
|
|
|
import RunLengthEncoding exposing (version, decode, encode)
|
2016-03-12 21:57:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
tests : Test
|
|
|
|
tests =
|
2016-08-17 11:14:17 +00:00
|
|
|
describe "RunLengthEncoding"
|
|
|
|
[ test "the solution is for the correct version of the test" <|
|
|
|
|
\() -> Expect.equal 2 version
|
2017-07-07 20:42:31 +00:00
|
|
|
, test "encode simple" <|
|
|
|
|
\() -> Expect.equal "2A3B4C" (encode "AABBBCCCC")
|
2017-07-05 20:35:15 +00:00
|
|
|
, skip <|
|
|
|
|
test "decode simple" <|
|
|
|
|
\() -> Expect.equal "AABBBCCCC" (decode "2A3B4C")
|
|
|
|
, skip <|
|
|
|
|
test "encode with single values" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal "12WB12W3B24WB"
|
|
|
|
(encode "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB")
|
|
|
|
, skip <|
|
|
|
|
test "decode with single values" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB"
|
|
|
|
(decode "12WB12W3B24WB")
|
|
|
|
, skip <|
|
|
|
|
test "(decode (encode (...)) combination" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal "zzz ZZ zZ"
|
|
|
|
(decode (encode "zzz ZZ zZ"))
|
|
|
|
, skip <|
|
|
|
|
test "decode with a x10 value" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal "WWWWWWWWWW"
|
|
|
|
(decode "10W")
|
|
|
|
, skip <|
|
|
|
|
test "encode unicode" <|
|
|
|
|
\() -> Expect.equal "⏰3⚽2⭐⏰" (encode "⏰⚽⚽⚽⭐⭐⏰")
|
|
|
|
, skip <|
|
|
|
|
test "decode unicode" <|
|
|
|
|
\() -> Expect.equal "⏰⚽⚽⚽⭐⭐⏰" (decode "⏰3⚽2⭐⏰")
|
2016-06-19 21:46:13 +00:00
|
|
|
]
|