Sha256: 02d3872eb5763776e94edd9bf479fc1e91ba71c2ee1f255e080dc84599c8deb8

Contents?: true

Size: 1.25 KB

Versions: 150

Compression:

Stored size: 1.25 KB

Contents

(* Test/exercise version: "1.1.0" *)

open Core
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 "}{");
  "wrong closing bracket" >::
    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

150 entries across 150 versions & 1 rubygems

Version Path
trackler-2.1.0.52 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.51 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.50 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.49 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.48 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.47 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.46 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.45 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.44 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.43 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.42 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.41 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.40 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.39 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.38 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.37 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.36 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.34 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.33 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.1.0.32 tracks/ocaml/exercises/bracket-push/test.ml