require "spec_helper"
RSpec.describe MathML2AsciiMath do
it "processes mstyle and mrow" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip.strip
INPUT
a diamond x^2 + b xx x + c_3
OUTPUT
end
it "processes mrow" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
a diamond x^(2d) + b xx x + c_(ab)
OUTPUT
end
it "processes mfrac" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
((1 + sqrt(5)))/(2)
OUTPUT
end
it "processes mfenced default" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
(a + b)
OUTPUT
end
it "processes mfenced with unmatching braces" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.to_s.strip
INPUT
[0,1)
OUTPUT
end
it "processes munderover" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
int_0^(oo)
OUTPUT
end
it "processes msubsup" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
int_(ab)^(ds)
OUTPUT
end
it "processes ubrace" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
ubrace (x + y + z)
OUTPUT
end
it "processes ul" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
ul (x + y + z)
OUTPUT
end
it "processes underset" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
underset(fred)((x + y + z))
OUTPUT
end
it "processes obrace" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
obrace x + y + z
OUTPUT
end
it "processes hat" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
hat x + y + z
OUTPUT
end
it "processes bar" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
bar x + y + z
OUTPUT
end
it "processes vec" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
vec x + y + z
OUTPUT
end
it "processes dot" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
dot x + y + z
OUTPUT
end
it "processes ddot" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
ddot x + y + z
OUTPUT
end
it "processes overset" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
overset(fred)(x + y + z)
OUTPUT
end
it "processes mtable" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
X = [[A,B],[C,D],[E,F]]
OUTPUT
end
it "processes wrapping element" do
expect(MathML2AsciiMath.m2a(<<~INPUT)).to eq <<~OUTPUT.strip
INPUT
bar lambda ( t_1 , t_2 )
OUTPUT
end
it "processes