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.22 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.21 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.20 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.19 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.18 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.17 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.16 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.15 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.14 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.13 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.12 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.11 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.10 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.9 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.8 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.7 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.6 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.5 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.4 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs
trackler-2.2.1.3 tracks/fsharp/exercises/run-length-encoding/RunLengthEncodingTest.fs