Sha256: c8351056f04bac0a62847e96de8edf2011300942a9c53934f7323becedcfe135

Contents?: true

Size: 1.16 KB

Versions: 132

Compression:

Stored size: 1.16 KB

Contents

open Core.Std
open OUnit2
open Bracket_push

let ae exp got _test_ctxt =
  assert_equal exp got ~printer:Bool.to_string

let tests = [
  "paired square brackets" >::
    ae true (are_balanced "[]");
  "empty string" >::
    ae true (are_balanced "");
  "unpaired brackets" >::
    ae false (are_balanced "[[");
  "wrong ordered brackets" >::
    ae false (are_balanced "}{");
  "paired with whitespace" >::
    ae true (are_balanced "{ }");
  "simple nested brackets" >::
    ae true (are_balanced "{[]}");
  "several paired brackets" >::
    ae true (are_balanced "{}[]");
  "paired and nested brackets" >::
    ae true (are_balanced "([{}({}[])])");
  "unopened closing brackets" >::
    ae false (are_balanced "{[)][]}");
  "unpaired and nested brackets" >::
    ae false (are_balanced "([{])");
  "paired and wrong nested brackets" >::
    ae false (are_balanced "[({]})");
  "math expression" >::
    ae true (are_balanced "(((185 + 223.85) * 15) - 543)/2");
  "complex latex expression" >::
    ae true (are_balanced "\\left(\\begin{array}{cc} \\frac{1}{3} & x\\\\ \\mathrm{e}^{x} &... x^2 \\end{array}\\right)");
]

let () =
  run_test_tt_main ("bracket-push tests" >::: tests)

Version data entries

132 entries across 132 versions & 1 rubygems

Version Path
trackler-2.0.6.44 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.43 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.42 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.41 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.40 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.39 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.38 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.37 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.36 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.35 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.34 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.33 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.32 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.31 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.30 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.29 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.28 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.27 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.26 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.0.6.25 tracks/ocaml/exercises/bracket-push/test.ml