Sha256: a95a7260708e38f45a6b5c06b221696568ab7fd494816429c369d053f92f8fff

Contents?: true

Size: 816 Bytes

Versions: 130

Compression:

Stored size: 816 Bytes

Contents

open! Core
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

130 entries across 130 versions & 1 rubygems

Version Path
trackler-2.2.1.116 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.115 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.114 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.113 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.111 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.110 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.109 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.108 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.107 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.106 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.105 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.104 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.103 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.102 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.101 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.100 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.99 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.98 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.97 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
trackler-2.2.1.96 tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml