Sha256: d9b356e73156611deb44308d18d856bd166135818a9cdec323417adbfd4a4789
Contents?: true
Size: 1.38 KB
Versions: 382
Compression:
Stored size: 1.38 KB
Contents
require "spec" require "../src/*" describe "Brackets" do describe "#are_valid?" do it "paired square brackets" do Brackets.are_valid?("[]").should be_true end it "empty string" do Brackets.are_valid?("").should be_true end it "unpaired brackets" do Brackets.are_valid?("[[").should be_false end it "wrong ordered brackets" do Brackets.are_valid?("}{").should be_false end it "paired with whitespace" do Brackets.are_valid?("{ }").should be_true end it "simple nested brackets" do Brackets.are_valid?("{[]}").should be_true end it "several paired brackets" do Brackets.are_valid?("{}[]").should be_true end it "paired and nested brackets" do Brackets.are_valid?("([{}({}[])])").should be_true end it "unopened closing brackets" do Brackets.are_valid?("{[)][]}").should be_false end it "unpaired and nested brackets" do Brackets.are_valid?("([{])").should be_false end it "paired and wrong nested brackets" do Brackets.are_valid?("[({]})").should be_false end it "math expression" do Brackets.are_valid?("(((185 + 223.85) * 15) - 543)/2").should be_true end it "complex latex expression" do Brackets.are_valid?("\left(\begin{array}{cc} \frac{1}{3} & x\\ \mathrm{e}^{x} &... x^2 \end{array}\right)").should be_true end end end
Version data entries
382 entries across 382 versions & 1 rubygems