require "spec_helper" RSpec.describe MathML2AsciiMath do it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT a x2 +b×x +c3 INPUT a diamond x^2 + b xx x + c_3 OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT a x2d +b×x +cab INPUT a diamond x^(2d) + b xx x + c_(ab) OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT 1 + 5 2 INPUT (( 1 + sqrt( 5 ) ))/( 2 ) OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT a + b INPUT ( a + b ) OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT 0 1 INPUT [ 0 , 1 ) OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT 0 INPUT \u222B_0^( oo ) OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT ab ds INPUT \u222B_(ab)^(ds) OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT x + y + z INPUT ubrace ( x + y + z ) OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT x + y + z ̲ INPUT ul ( x + y + z ) OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT x + y + z fred INPUT underset(fred)(( x + y + z )) OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT x + y + z INPUT obrace x + y + z OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT x + y + z ^ INPUT hat x + y + z OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT x + y + z ¯ INPUT bar x + y + z OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT x + y + z INPUT vec x + y + z OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT x + y + z . INPUT dot x + y + z OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT x + y + z .. INPUT ddot x + y + z OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT x + y + z fred INPUT overset(fred)( x + y + z ) OUTPUT end it "processes some MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT X = A B C D E F INPUT X = [[A,B],[C,D],[E,F]] OUTPUT end it "processes wrapping element" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT λ ¯ ( t 1 , t 2 ) INPUT bar lambda ( t_1 , t_2 ) OUTPUT end it "processes without xmlns" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT z ¯ ( t 1 , t 2 ) INPUT bar z ( t_1 , t_2 ) OUTPUT end it "processes and skips element" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT z ¯ ( t 1 , t 2 ) MathType@MTEF@5@5@+=feaagCart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbbjxAHXgarqqtubsr4rNCHbGeaGqipG0dh9qqWrVepG0dbbL8F4rqqrVepeea0xe9LqFf0xc9q8qqaqFn0lXdHiVcFbIOFHK8Feea0dXdar=Jb9hs0dXdHuk9fr=xfr=xfrpeWZqaaeqabiGaciGacaqadmaadaqaaqaaaOqaaiqadQhagaqeaiaacIcacaWG0bWaaSbaaSqaaiaaigdaaeqaaOGaaiilaiaaysW7caWG0bWaaSbaaSqaaiaaikdaaeqaaOGaaiykaaaa@3DCE@ INPUT bar z ( t_1 , t_2 ) OUTPUT end it "processes some unknown MathML" do expect(MathML2AsciiMath.m2a(<<~INPUT)).to match_fuzzy <<~OUTPUT x + y + z INPUT x + \n y \n + \n z OUTPUT end end