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.159 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.158 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.157 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.156 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.155 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.154 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.153 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.152 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.151 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.150 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.149 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.148 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.147 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.146 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.145 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.144 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.143 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.142 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.141 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.140 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml