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.139 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.138 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.137 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.136 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.135 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.134 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.133 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.132 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.131 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.130 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.129 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.128 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.127 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.126 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.125 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.124 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.123 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.122 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.121 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.120 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml