Sha256: abfc33dd553d6e096e2641df2c94301c64539623fe55bc78b058265e4965f304

Contents?: true

Size: 1.25 KB

Versions: 44

Compression:

Stored size: 1.25 KB

Contents

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

open Base
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

44 entries across 44 versions & 1 rubygems

Version Path
trackler-2.2.1.155 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.154 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.153 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.152 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.151 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.150 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.149 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.148 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.147 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.146 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.145 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.144 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.143 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.142 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.141 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.140 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.139 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.138 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.137 tracks/ocaml/exercises/bracket-push/test.ml
trackler-2.2.1.136 tracks/ocaml/exercises/bracket-push/test.ml