Sha256: 7889e0cae8b3a04ab8afb76aa3e2466b356f1faad935c24806990b990d4539fd

Contents?: true

Size: 1.18 KB

Versions: 156

Compression:

Stored size: 1.18 KB

Contents

open Core
open OUnit2
open Beer_song

let zip s1 s2 = 
  let rec go s1 s2 acc = match (s1,s2) with
  | ([], _) -> acc
  | (_, []) -> acc
  | (x::xs, y::ys) -> go xs ys ((x,y)::acc) in List.rev @@ go s1 s2 []

 let find_diffs s1 s2 =
   let s1 = String.to_list s1 in
   let s2 = String.to_list s2 in
   let both = zip s1 s2 in
   List.find_mapi both ~f:(fun i (c1, c2) -> if c1 = c2 then None else Some (sprintf "Diff at index %d: %c <> %c" i c1 c2))
 
 let diff_message s1 s2 = match find_diffs s1 s2 with
 | None -> if String.length s1 = String.length s2 then "" else "Lengths of expected and actual differ but have a common prefix."
 | Some m -> m
 
 let ae exp got _test_ctxt = 
   if exp = got 
    then ()
    else failwith @@ "Expected differs from actual: " ^ (diff_message exp got)

let (* SUITE verse *)verse_tests = [
(* TEST
   "$description" >::
     ae $expected 
     (verse $number);
   END TEST *)
]
(* END SUITE *)

let (* SUITE lyrics *)lyrics_tests = [
(* TEST
   "$description" >::
     ae $expected 
     (lyrics ~from:$beginning ~until:$end);
   END TEST *)
]
(* END SUITE *)

let () =
  run_test_tt_main (
    "beer song tests" >:::
      List.concat [verse_tests; lyrics_tests]
  )

Version data entries

156 entries across 156 versions & 1 rubygems

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