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.0.8.40 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.39 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.38 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.37 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.36 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.35 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.34 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.33 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.32 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.31 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.30 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.29 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.28 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.27 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.26 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.24 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.23 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.22 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.21 tracks/fsharp/exercises/change/ChangeTest.fs
trackler-2.0.8.20 tracks/fsharp/exercises/change/ChangeTest.fs