Sha256: 818de5c27a8c73288c38d7fe3be3c97f2d2a17ffb73d4acb9238056df3108db9

Contents?: true

Size: 1.82 KB

Versions: 240

Compression:

Stored size: 1.82 KB

Contents

module RunLengthEncodingTest

open NUnit.Framework
open System.Text

open RunLengthEncoding

[<Test>]
let ``Encode simple`` () =
    let input = "AABBBCCCC"
    let expected = "2A3B4C"
    Assert.That(encode input, Is.EqualTo(expected))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Decode simple`` () =
    let input = "2A3B4C"
    let expected = "AABBBCCCC"
    Assert.That(decode input, Is.EqualTo(expected))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Encode with single values`` () =
    let input = "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB"
    let expected = "12WB12W3B24WB"
    Assert.That(encode input, Is.EqualTo(expected))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Decode with single values`` () =
    let input = "12WB12W3B24WB"
    let expected = "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB"
    Assert.That(decode input, Is.EqualTo(expected))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Encode and then decode`` () =
    let input = "zzz ZZ  zZ"
    let expected = "zzz ZZ  zZ"
    Assert.That(encode input |> decode, Is.EqualTo(expected))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Encode unicode`` () =
    let input = Encoding.Unicode.GetString([|240uy; 35uy; 189uy; 38uy; 189uy; 38uy; 189uy; 38uy; 80uy; 43uy; 80uy; 43uy; 240uy; 35uy|])
    let expected = Encoding.Unicode.GetString([|240uy; 35uy; 51uy; 0uy; 189uy; 38uy; 50uy; 0uy; 80uy; 43uy; 240uy; 35uy|])
    Assert.That(encode input, Is.EqualTo(expected))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Decode unicode`` () =
    let input = Encoding.Unicode.GetString([|240uy; 35uy; 51uy; 0uy; 189uy; 38uy; 50uy; 0uy; 80uy; 43uy; 240uy; 35uy|])
    let expected = Encoding.Unicode.GetString([|240uy; 35uy; 189uy; 38uy; 189uy; 38uy; 189uy; 38uy; 80uy; 43uy; 80uy; 43uy; 240uy; 35uy|])
    Assert.That(decode input, Is.EqualTo(expected))

Version data entries

240 entries across 240 versions & 1 rubygems

Version Path
trackler-2.2.1.2 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.1 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.0 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.0.6 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.0.5 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.0.4 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.0.3 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.0.2 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.0.1 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.0.0 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.1.0.55 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.1.0.54 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.1.0.53 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.1.0.52 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.1.0.51 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.1.0.50 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.1.0.49 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.1.0.48 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.1.0.47 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.1.0.46 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs