Sha256: 982cc1011ff6edeff5b6e3af78c3fb6e4d28bb0be80b76be1da655ef653fc400

Contents?: true

Size: 1.9 KB

Versions: 240

Compression:

Stored size: 1.9 KB

Contents

module ChangeTest

open NUnit.Framework

open Change

[<Test>]
let ``Single coin change`` () =
    let actual = [1; 5; 10; 25; 100]
    let target = 25
    let expected = Some [25]
    Assert.That(change target actual, Is.EqualTo(expected))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Multiple coin change`` () =
    let actual = [1; 5; 10; 25; 100]
    let target = 15
    let expected = Some [5; 10]
    Assert.That(change target actual, Is.EqualTo(expected))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Change with Lilliputian Coins`` () =
    let actual = [1; 4; 15; 20; 50]
    let target = 23
    let expected = Some [4; 4; 15]
    Assert.That(change target actual, Is.EqualTo(expected))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Change with Lower Elbonia Coins`` () =
    let actual = [1; 5; 10; 21; 25]
    let target = 63
    let expected = Some [21; 21; 21]
    Assert.That(change target actual, Is.EqualTo(expected))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Large target values`` () =
    let actual = [1; 2; 5; 10; 20; 50; 100]
    let target = 999
    let expected = Some [2; 2; 5; 20; 20; 50; 100; 100; 100; 100; 100; 100; 100; 100; 100]
    Assert.That(change target actual, Is.EqualTo(expected))

[<Test>]
[<Ignore("Remove to run test")>]
let ``No coins make 0 change`` () =
    let actual = [1; 5; 10; 21; 25]
    let target = 0
    let (expected: int list option) = Some []
    Assert.That(change target actual, Is.EqualTo(expected))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Error testing for change smaller than the smallest of coins`` () =
    let actual = [5; 10]
    let target = 3
    let expected = None
    Assert.That(change target actual, Is.EqualTo(expected))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Cannot find negative change values`` () =
    let actual = [1; 2; 5]
    let target = -5
    let expected = None
    Assert.That(change target actual, Is.EqualTo(expected))

Version data entries

240 entries across 240 versions & 1 rubygems

Version Path
trackler-2.1.0.4 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.1.0.3 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.1.0.2 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.1.0.1 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.1.0.0 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.55 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.54 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.53 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.52 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.51 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.50 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.49 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.48 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.47 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.46 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.45 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.44 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.43 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.42 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.41 tracks/fsharp/exercises/change/ChangeTest.fs