Sha256: 4dee3e08610175a7b11e871d0cd0f82697caf8255206e5170d6baedac555f342

Contents?: true

Size: 1.44 KB

Versions: 246

Compression:

Stored size: 1.44 KB

Contents

use "example.sml";

val test_cases = [
  {
    number = 1,
    expected = "1"
  },
  {
    number = 3,
    expected = "Pling"
  },
  {
    number = 5,
    expected = "Plang"
  },
  {
    number = 7,
    expected = "Plong"
  },
  {
    number = 6,
    expected = "Pling"
  },
  {
    number = 8,
    expected = "8"
  },
  {
    number = 9,
    expected = "Pling"
  },
  {
    number = 10,
    expected = "Plang"
  },
  {
    number = 14,
    expected = "Plong"
  },
  {
    number = 15,
    expected = "PlingPlang"
  },
  {
    number = 21,
    expected = "PlingPlong"
  },
  {
    number = 25,
    expected = "Plang"
  },
  {
    number = 27,
    expected = "Pling"
  },
  {
    number = 35,
    expected = "PlangPlong"
  },
  {
    number = 49,
    expected = "Plong"
  },
  {
    number = 52,
    expected = "52"
  },
  {
    number = 105,
    expected = "PlingPlangPlong"
  },
  {
    number = 3125,
    expected = "Plang"
  }
]

fun run_tests _ [] = []
  | run_tests f (x :: xs) =
      let
        fun aux { number, expected } =
          let
            val output = f number
            val is_correct = output = expected
            val expl =
              "convert " ^ (Int.toString number) ^ ": " ^
              (if not is_correct then "FAILED" else "PASSED") ^ "\n"
          in
            (print (expl); is_correct)
          end
      in
        (aux x) :: run_tests f xs
      end

val allTestsPass = List.all (fn x => x) (run_tests convert test_cases)   

Version data entries

246 entries across 246 versions & 1 rubygems

Version Path
trackler-2.0.5.1 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.5.0 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.4.0 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.3.9 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.3.8 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.3.7 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.3.6 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.3.5 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.3.4 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.3.3 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.3.2 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.3.1 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.3.0 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.2.0 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.1.2 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.1.1 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.1.0 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.0.10 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.0.9 tracks/sml/exercises/raindrops/test_raindrops.sml
trackler-2.0.0.8 tracks/sml/exercises/raindrops/test_raindrops.sml