Sha256: b77c52354c984582538bc09755e5900d9d43773aa3f450992dd36bbd18b4012a

Contents?: true

Size: 815 Bytes

Versions: 63

Compression:

Stored size: 815 Bytes

Contents

open Base
open OUnit2
open Bowling

type game = Bowling.t

let to_ok = function
| Ok x -> x
| Error e -> failwith @@ "should be OK but got Error " ^ e

let set_previous_frames (frames : int list): game =
  List.fold frames ~init:new_game ~f:(fun g f -> roll f g |> to_ok)

let score_printer = function
| Ok n -> Int.to_string n
| Error e -> e
let assert_score exp game = assert_equal ~printer:score_printer exp (score game)

let roll_printer = function
| Ok _ -> "Ok <some game>"
| Error e -> e
let assert_roll exp frame game = assert_equal ~printer:roll_printer exp (roll frame game)

let tests = [
(* TEST
   "$description" >:: (fun _ ->
      let g = set_previous_frames $previous_rolls in
      assert_$property $expected $roll g
   );
   END TEST *)
]

let () =
  run_test_tt_main ("bowling tests" >::: tests)

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.179 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.178 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.177 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.176 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.175 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.174 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.173 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.172 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.171 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.170 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.169 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.167 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.166 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.165 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.164 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.163 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.162 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.161 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.160 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml