Sha256: 8f965dc6ab06f69ad5da16543592cbddc10bf941e030f387be71e4196113d1f9

Contents?: true

Size: 1.28 KB

Versions: 151

Compression:

Stored size: 1.28 KB

Contents

open Core
open OUnit2

module CMap = Char.Map

(* Assert Int Equals *)
let aie exp got _test_ctxt =
  let printer = Int.to_string in
  assert_equal exp got ~printer
(* Assert Map Equals *)
let ame exp got =
  let printer m = CMap.sexp_of_t Int.sexp_of_t m |> Sexp.to_string_hum ~indent:1 in
  assert_equal exp got ~cmp:(CMap.equal (=)) ~printer

let tests =
  ["empty dna string has no adenine">::
    aie 0 (Nucleotide_count.count "" 'A');
   "empty dna string has no nucleotides">:: (fun _ ->
    let exp = CMap.empty in
    ame exp (Nucleotide_count.nucleotide_counts ""));
   "repetitive cytosine gets counted">::
    aie 5 (Nucleotide_count.count "CCCCC" 'C');
   "repetitive sequence has only guanine">:: (fun _ ->
    let exp = CMap.singleton 'G' 8 in
    ame exp (Nucleotide_count.nucleotide_counts "GGGGGGGG"));
   "counts only thymine">::
    aie 1 (Nucleotide_count.count "GGGGGTAACCCGG" 'T');
   "dna has no uracil">::
    aie 0 (Nucleotide_count.count "GATTACA" 'U');
   "counts all nucleotides">:: (fun _ ->
    let s = "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC" in
    let exp = CMap.of_alist_exn [('A', 20); ('T', 21); ('C', 12); ('G', 17)] in
    ame exp (Nucleotide_count.nucleotide_counts s))
  ]

let () =
  run_test_tt_main ("nucleotide-counts tests" >::: tests)

Version data entries

151 entries across 151 versions & 1 rubygems

Version Path
trackler-2.2.1.70 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.69 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.68 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.67 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.66 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.65 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.64 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.63 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.62 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.61 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.60 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.59 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.58 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.57 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.56 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.55 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.54 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.53 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.52 tracks/ocaml/exercises/nucleotide-count/test.ml
trackler-2.2.1.51 tracks/ocaml/exercises/nucleotide-count/test.ml