private MathSequence CreateSingleSequence(string text)
        {
            var seq = new MathObjectFactory(text).Create().TestSingleMath();

            seq.OriginalText.Is(text);
            return(seq);
        }
Example #2
0
        public void ApplyParameter_米田()
        {
            var mor = Morphism.Create(@"\yoneda_{#1?}\colon #1\rightarrow \widehat{#1}").TestSingle();

            mor.Name.AsMathSequence().List.Count.Is(1);
            mor.Name.AsMathSequence().List[0].IsMathToken(@"\yoneda");
            mor.Name.AsMathSequence().Sub.IsMathToken("#1?");
            mor.Source.IsMathToken("#1");
            mor.Target.AsMathSequence().List.Count.Is(2);
            mor.Target.AsMathSequence().List[0].IsMathToken(@"\widehat");
            mor.Target.AsMathSequence().List[1].AsMathSequence().List.Count.Is(1);
            mor.Target.AsMathSequence().List[1].AsMathSequence().List[0].IsMathToken("#1");
            mor.Target.AsMathSequence().List[1].AsMathSequence().LeftBracket.TestToken("{");
            mor.Target.AsMathSequence().List[1].AsMathSequence().RightBracket.TestToken("}");

            var f          = new MathObjectFactory(@"\yoneda_a").CreateSingle();
            var parameters = new Dictionary <string, MathObject>();

            mor.Name.IsSameType(f, parameters).IsTrue();
            mor = mor.ApplyParameter(f, parameters, false).TestSingle();
            mor.Name.AsMathSequence().List.Count.Is(1);
            mor.Name.AsMathSequence().List[0].IsMathToken(@"\yoneda");
            mor.Name.AsMathSequence().Sub.IsMathToken("a");
            mor.Source.IsMathToken("a");
            mor.Target.AsMathSequence().List.Count.Is(2);
            mor.Target.AsMathSequence().List[0].IsMathToken(@"\widehat");
            mor.Target.AsMathSequence().List[1].AsMathSequence().List.Count.Is(1);
            mor.Target.AsMathSequence().List[1].AsMathSequence().List[0].IsMathToken("a");
            mor.Target.AsMathSequence().List[1].AsMathSequence().LeftBracket.TestToken("{");
            mor.Target.AsMathSequence().List[1].AsMathSequence().RightBracket.TestToken("}");
            mor.Target.ToTokenString().TestString(@"\widehat{a}");
        }
Example #3
0
        public void Functor_対角関手2()
        {
            var list = new List <Functor>()
            {
                Functor.Create(@"\Delta #1(#2)", "#1"),
                Functor.Create(@"\Hom(#1, #2)", @"\Hom(#1, #2)"),
                Functor.Create(@"\Hom_{#3}(#1, #2)", @"\Hom_{#3}(#1, #2)"),
            };
            var dic = new Dictionary <TokenString, Morphism>()
            {
                { "F".ToTokenString(), new Morphism("F", @"\cat{C}", @"\cat{D}", MorphismType.Functor, -1) }
            };

            var left  = new MathObjectFactory(@"\Hom(\Delta(\lim T)(x), F(u))").CreateSingle();
            var right = new MathObjectFactory(@"\Hom(\lim T, Fu)").CreateSingle();

            new TikZDiagram("", -1, false, false, true, dic, Array.Empty <Morphism>(), list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory(@"\Hom_{\cat{C}}(\Delta(\lim T)(x), F(u))").CreateSingle();
            right = new MathObjectFactory(@"\Hom_{\cat{C}}(\lim T, Fu)").CreateSingle();
            new TikZDiagram("", -1, false, false, true, dic, Array.Empty <Morphism>(), list)
            .EqualsAsMathObject(left, right)
            .IsTrue();
        }
Example #4
0
        public void Functor_恒等関手()
        {
            var list = new List <Functor>()
            {
                Functor.Create(@"\id_{#2?}#1", "#1")
            };

            var left  = new MathObjectFactory(@"\id_{\cat{C}}(a)").CreateSingle();
            var right = new MathObjectFactory("a").CreateSingle();

            CreateTikZDiagram(list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory(@"\id(x)").CreateSingle();
            right = new MathObjectFactory("x").CreateSingle();

            CreateTikZDiagram(list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory(@"\id_{\cat{C}}(f\otimes g)").CreateSingle();
            right = new MathObjectFactory(@"f\otimes g").CreateSingle();

            CreateTikZDiagram(list)
            .EqualsAsMathObject(left, right)
            .IsTrue();
        }
Example #5
0
        public void Functor_米田2()
        {
            var list = new List <Functor>()
            {
                Functor.Create(@"\yoneda(#2)(#1)", @"\Hom(#1, #2)"),
                Functor.Create("F#1", "G(#1)")
            };

            var left  = new MathObjectFactory(@"\yoneda(a)(b)").CreateSingle();
            var right = new MathObjectFactory(@"\Hom(b, a)").CreateSingle();

            CreateTikZDiagram(list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory(@"F(\yoneda(a)(b))").CreateSingle();
            right = new MathObjectFactory(@"G(\Hom(b, a))").CreateSingle();
            CreateTikZDiagram(list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory(@"F(\yoneda a b)").CreateSingle();
            right = new MathObjectFactory(@"G(\Hom(b, a))").CreateSingle();
            CreateTikZDiagram(list)
            .EqualsAsMathObject(left, right)
            .IsTrue();
        }
Example #6
0
        public void 通常()
        {
            var token = new MathObjectFactory("F").Create().TestSingle();

            token.IsMathToken("F");
            token.ToTokenString().TestString("F");
            token.OriginalText.Is("F");

            var math = CreateSingleSequence("Fg");

            math.List.Count.Is(2);
            math.List[0].IsMathToken("F");
            math.List[1].IsMathToken("g");
            math.Sup.IsNull();
            math.Sub.IsNull();
            math.Main.TestString("Fg");
            math.ToTokenString().TestString("Fg");

            math = CreateSingleSequence("abcdefg");
            math.List.Count.Is(7);
            math.List[0].IsMathToken("a");
            math.List[1].IsMathToken("b");
            math.List[2].IsMathToken("c");
            math.List[3].IsMathToken("d");
            math.List[4].IsMathToken("e");
            math.List[5].IsMathToken("f");
            math.List[6].IsMathToken("g");
            math.Sup.IsNull();
            math.Sub.IsNull();
            math.Main.TestString("abcdefg");
            math.ToTokenString().TestString("abcdefg");
            math.OriginalText.Is("abcdefg");
        }
Example #7
0
        public void Functor_括弧なし()
        {
            var list = new List <Functor>()
            {
                Functor.Create("F#1", "G#1")
            };

            var left  = new MathObjectFactory("Fa").CreateSingle();
            var right = new MathObjectFactory("Ga").CreateSingle();

            CreateTikZDiagram(list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory("F(a)").CreateSingle();
            right = new MathObjectFactory("Ga").CreateSingle();
            CreateTikZDiagram(list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory("Fa").CreateSingle();
            right = new MathObjectFactory("G(a)").CreateSingle();
            CreateTikZDiagram(list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory("F(a)").CreateSingle();
            right = new MathObjectFactory("G(a)").CreateSingle();
            CreateTikZDiagram(list)
            .EqualsAsMathObject(left, right)
            .IsTrue();
        }
Example #8
0
        public void Morphism_通常()
        {
            var dic = new Dictionary <TokenString, Morphism>
            {
                { "F".ToTokenString(), new Morphism("F", @"\cat{C}", @"\cat{D}", MorphismType.Functor, -1) },
            };

            var left  = new MathObjectFactory("Fa").CreateSingle();
            var right = new MathObjectFactory("Fa").CreateSingle();

            new TikZDiagram("", -1, false, false, true, dic, Array.Empty <Morphism>(), Array.Empty <Functor>())
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory("F(a)").CreateSingle();
            right = new MathObjectFactory("Fa").CreateSingle();
            new TikZDiagram("", -1, false, false, true, dic, Array.Empty <Morphism>(), Array.Empty <Functor>())
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory("Fa").CreateSingle();
            right = new MathObjectFactory("F(a)").CreateSingle();
            new TikZDiagram("", -1, false, false, true, dic, Array.Empty <Morphism>(), Array.Empty <Functor>())
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory("F(a)").CreateSingle();
            right = new MathObjectFactory("F(a)").CreateSingle();
            new TikZDiagram("", -1, false, false, true, dic, Array.Empty <Morphism>(), Array.Empty <Functor>())
            .EqualsAsMathObject(left, right)
            .IsTrue();
        }
Example #9
0
        public void Functor_対角関手1()
        {
            var list = new List <Functor>()
            {
                Functor.Create(@"\Delta #1(#2)", "#1"),
            };

            var left  = new MathObjectFactory(@"\Delta a(x)").CreateSingle();
            var right = new MathObjectFactory("a").CreateSingle();

            CreateTikZDiagram(list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory(@"\Delta (a+b)(x)").CreateSingle();
            right = new MathObjectFactory("a+b").CreateSingle();

            CreateTikZDiagram(list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory(@"GF(\Delta a(x))").CreateSingle();
            right = new MathObjectFactory("GFa").CreateSingle();
            var dic = new Dictionary <TokenString, Morphism>
            {
                { "F".ToTokenString(), new Morphism("F", @"\cat{C}", @"\cat{D}", MorphismType.Functor, -1) },
                { "G".ToTokenString(), new Morphism("G", @"\cat{C}", @"\cat{D}", MorphismType.Functor, -1) },
            };

            new TikZDiagram("", -1, false, false, true, dic, Array.Empty <Morphism>(), list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory(@"GF(\Delta a(x))").CreateSingle();
            right = new MathObjectFactory("GF(a)").CreateSingle();
            new TikZDiagram("", -1, false, false, true, dic, Array.Empty <Morphism>(), list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory(@"GF(\Delta a(x))").CreateSingle();
            right = new MathObjectFactory("G(Fa)").CreateSingle();
            new TikZDiagram("", -1, false, false, true, dic, Array.Empty <Morphism>(), list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory(@"GF(\Delta a(x))").CreateSingle();
            right = new MathObjectFactory("G(F(a))").CreateSingle();
            new TikZDiagram("", -1, false, false, true, dic, Array.Empty <Morphism>(), list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory(@"G(F(\Delta a(x)))").CreateSingle();
            right = new MathObjectFactory("GFa").CreateSingle();
            new TikZDiagram("", -1, false, false, true, dic, Array.Empty <Morphism>(), list)
            .EqualsAsMathObject(left, right)
            .IsTrue();
        }
Example #10
0
        public void ApplyParameter_通常()
        {
            var mor = Morphism.Create(@"\theta^{#1}\colon F(#1)\rightarrow G#1").TestSingle();

            mor.Name.AsMathSequence().List.Count.Is(1);
            mor.Name.AsMathSequence().List[0].IsMathToken(@"\theta");
            mor.Name.AsMathSequence().Sup.IsMathToken("#1");
            mor.Source.AsMathSequence().List.Count.Is(2);
            mor.Source.AsMathSequence().List[0].IsMathToken("F");
            mor.Source.AsMathSequence().List[1].AsMathSequence().List.Count.Is(1);
            mor.Source.AsMathSequence().List[1].AsMathSequence().List[0].IsMathToken("#1");
            mor.Source.AsMathSequence().List[1].AsMathSequence().LeftBracket.TestToken("(");
            mor.Source.AsMathSequence().List[1].AsMathSequence().RightBracket.TestToken(")");
            mor.Target.AsMathSequence().List.Count.Is(2);
            mor.Target.AsMathSequence().List[0].IsMathToken("G");
            mor.Target.AsMathSequence().List[1].IsMathToken("#1");

            var f          = new MathObjectFactory(@"\theta^i").CreateSingle();
            var parameters = new Dictionary <string, MathObject>();

            mor.Name.IsSameType(f, parameters).IsTrue();
            mor = mor.ApplyParameter(f, parameters, false).TestSingle();
            mor.Name.AsMathSequence().List.Count.Is(1);
            mor.Name.AsMathSequence().List[0].IsMathToken(@"\theta");
            mor.Name.AsMathSequence().Sup.IsMathToken("i");
            mor.Source.AsMathSequence().List.Count.Is(2);
            mor.Source.AsMathSequence().List[0].IsMathToken("F");
            mor.Source.AsMathSequence().List[1].AsMathSequence().List.Count.Is(1);
            mor.Source.AsMathSequence().List[1].AsMathSequence().List[0].IsMathToken("i");
            mor.Source.AsMathSequence().List[1].AsMathSequence().LeftBracket.TestToken("(");
            mor.Source.AsMathSequence().List[1].AsMathSequence().RightBracket.TestToken(")");
            mor.Target.AsMathSequence().List.Count.Is(2);
            mor.Target.AsMathSequence().List[0].IsMathToken("G");
            mor.Target.AsMathSequence().List[1].IsMathToken("i");

            f          = new MathObjectFactory(@"\theta^{i}").CreateSingle();
            parameters = new Dictionary <string, MathObject>();
            mor.Name.IsSameType(f, parameters).IsTrue();
            mor = mor.ApplyParameter(f, parameters, false).TestSingle();
            mor.Name.AsMathSequence().List.Count.Is(1);
            mor.Name.AsMathSequence().List[0].IsMathToken(@"\theta");
            mor.Name.AsMathSequence().Sup.IsMathToken("i");
            mor.Source.AsMathSequence().List.Count.Is(2);
            mor.Source.AsMathSequence().List[0].IsMathToken("F");
            mor.Source.AsMathSequence().List[1].AsMathSequence().List.Count.Is(1);
            mor.Source.AsMathSequence().List[1].AsMathSequence().List[0].IsMathToken("i");
            mor.Source.AsMathSequence().List[1].AsMathSequence().LeftBracket.TestToken("(");
            mor.Source.AsMathSequence().List[1].AsMathSequence().RightBracket.TestToken(")");
            mor.Target.AsMathSequence().List.Count.Is(2);
            mor.Target.AsMathSequence().List[0].IsMathToken("G");
            mor.Target.AsMathSequence().List[1].IsMathToken("i");
        }
Example #11
0
        public void  数1()
        {
            var token = new MathObjectFactory("#1").Create().TestSingle();

            token.IsMathToken("#1");
            token.OriginalText.Is("#1");

            token = new MathObjectFactory("#1?").Create().TestSingle();
            token.IsMathToken("#1?");
            token.OriginalText.Is("#1?");

            token = new MathObjectFactory("#1s").Create().TestSingle();
            token.IsMathToken("#1s");
            token.OriginalText.Is("#1s");

            token = new MathObjectFactory("#1t").Create().TestSingle();
            token.IsMathToken("#1t");
            token.OriginalText.Is("#1t");

            var math = CreateSingleSequence("#1#2");

            math.List.Count.Is(2);
            math.List[0].IsMathToken("#1");
            math.List[1].IsMathToken("#2");
            math.Main.TestString("#1#2");
            math.ToTokenString().TestString("#1#2");

            math = CreateSingleSequence("#1#2?");
            math.List.Count.Is(2);
            math.List[0].IsMathToken("#1");
            math.List[1].IsMathToken("#2?");
            math.Main.TestString("#1#2?");
            math.ToTokenString().TestString("#1#2?");

            math = CreateSingleSequence("#1u");
            math.List.Count.Is(2);
            math.List[0].IsMathToken("#1");
            math.List[1].IsMathToken("u");
            math.Main.TestString("#1 u");
            math.ToTokenString().TestString("#1u");

            math = CreateSingleSequence("abc_{#1?}");
            math.List.Count.Is(3);
            math.List[0].IsMathToken("a");
            math.List[1].IsMathToken("b");
            math.List[2].Main.TestString("c");
            math.List[2].AsMathSequence().Sup.IsNull();
            math.List[2].AsMathSequence().Sub.IsMathToken("#1?");
            math.Main.TestString("abc_{#1?}");
            math.ToTokenString().TestString("abc_{#1?}");
        }
Example #12
0
        public void Functor_括弧あり()
        {
            var list = new List <Functor>()
            {
                Functor.Create("F#1", "G(#1)")
            };

            var left  = new MathObjectFactory("Fa").CreateSingle();
            var right = new MathObjectFactory("G(a)").CreateSingle();

            CreateTikZDiagram(list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory("F(a)").CreateSingle();
            right = new MathObjectFactory("G(a)").CreateSingle();
            CreateTikZDiagram(list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            //left = new MathObjectFactory("Fa").CreateSingle();
            //right = new MathObjectFactory("Ga").CreateSingle();
            //CreateTikZDiagram(list)
            //    .CheckNode(left, right)
            //    .IsTrue();

            //left = new MathObjectFactory("F(a)").CreateSingle();
            //right = new MathObjectFactory("Ga").CreateSingle();
            //CreateTikZDiagram(list)
            //    .CheckNode(left, right)
            //    .IsTrue();

            var dic = new Dictionary <TokenString, Morphism>
            {
                { "G".ToTokenString(), new Morphism("G", @"\cat{C}", @"\cat{D}", MorphismType.Functor, -1) },
            };

            left  = new MathObjectFactory("Fa").CreateSingle();
            right = new MathObjectFactory("Ga").CreateSingle();
            new TikZDiagram("", -1, false, false, true, dic, Array.Empty <Morphism>(), list)
            .EqualsAsMathObject(left, right)
            .IsTrue();

            left  = new MathObjectFactory("F(a)").CreateSingle();
            right = new MathObjectFactory("Ga").CreateSingle();
            new TikZDiagram("", -1, false, false, true, dic, Array.Empty <Morphism>(), list)
            .EqualsAsMathObject(left, right)
            .IsTrue();
        }
Example #13
0
        public void 空()
        {
            var math = new MathObjectFactory("").CreateSingle();

            math.OriginalText.Is("");
            math.AsMathSequence().List.Count.Is(0);
            math.Main.TestString("");
            math.ToTokenString().TestString("");

            math = new MathObjectFactory("{}").CreateSingle();
            math.OriginalText.Is("{}");
            math.AsMathSequence().List.Count.Is(0);
            math.Main.TestString("");
            math.AsMathSequence().LeftBracket.TestToken("{");
            math.AsMathSequence().RightBracket.TestToken("}");
            math.ToTokenString().TestString("{}");

            math = new MathObjectFactory("{}^i").CreateSingle();
            math.OriginalText.Is("{}^i");
            math.AsMathSequence().List.Count.Is(0);
            math.Main.TestString("");
            math.AsMathSequence().LeftBracket.TestToken("{");
            math.AsMathSequence().RightBracket.TestToken("}");
            math.AsMathSequence().Sup.IsMathToken("i");
            math.AsMathSequence().Sub.IsNull();
            math.ToTokenString().TestString("{}^i");

            math = new MathObjectFactory("{}_j").CreateSingle();
            math.OriginalText.Is("{}_j");
            math.AsMathSequence().List.Count.Is(0);
            math.Main.TestString("");
            math.AsMathSequence().LeftBracket.TestToken("{");
            math.AsMathSequence().RightBracket.TestToken("}");
            math.AsMathSequence().Sup.IsNull();
            math.AsMathSequence().Sub.IsMathToken("j");
            math.ToTokenString().TestString("{}_j");

            math = new MathObjectFactory("{}^i_j").CreateSingle();
            math.OriginalText.Is("{}^i_j");
            math.AsMathSequence().List.Count.Is(0);
            math.Main.TestString("");
            math.AsMathSequence().LeftBracket.TestToken("{");
            math.AsMathSequence().RightBracket.TestToken("}");
            math.AsMathSequence().Sup.IsMathToken("i");
            math.AsMathSequence().Sub.IsMathToken("j");
            math.ToTokenString().TestString("{}^i_j");
        }
Example #14
0
        public void TeXコマンド()
        {
            var token = new MathObjectFactory(@"\theta").Create().TestSingle();

            token.IsMathToken(@"\theta");
            token.ToTokenString().TestString(@"\theta");
            token.OriginalText.Is(@"\theta");

            var math = CreateSingleSequence(@"F\theta");

            math.List.Count.Is(2);
            math.List[0].IsMathToken("F");
            math.List[1].IsMathToken(@"\theta");
            math.Main.TestString(@"F\theta");
            math.ToTokenString().TestString(@"F\theta");
            math.OriginalText.Is(@"F\theta");

            math = CreateSingleSequence(@"\cat{C}");
            math.List.Count.Is(2);
            math.List[0].IsMathToken(@"\cat");
            math.List[1].AsMathSequence().List.Count.Is(1);
            math.List[1].AsMathSequence().List[0].IsMathToken("C");
            math.List[1].AsMathSequence().LeftBracket.TestToken("{");
            math.List[1].AsMathSequence().RightBracket.TestToken("}");
            math.List[1].ToTokenString().TestString("{C}");
            math.Main.TestString(@"\cat{C}");
            math.ToTokenString().TestString(@"\cat{C}");
            math.OriginalText.Is(@"\cat{C}");

            math = CreateSingleSequence(@"\encat{C}\otimes\encat{D}");
            math.List.Count.Is(5);
            math.List[0].IsMathToken("\\encat");
            math.List[1].AsMathSequence().List.Count.Is(1);
            math.List[1].AsMathSequence().List[0].IsMathToken("C");
            math.List[1].AsMathSequence().LeftBracket.TestToken("{");
            math.List[1].AsMathSequence().RightBracket.TestToken("}");
            math.List[2].IsMathToken("\\otimes");
            math.List[3].IsMathToken("\\encat");
            math.List[4].AsMathSequence().List.Count.Is(1);
            math.List[4].AsMathSequence().List[0].IsMathToken("D");
            math.List[4].AsMathSequence().LeftBracket.TestToken("{");
            math.List[4].AsMathSequence().RightBracket.TestToken("}");
            math.Main.TestString(@"\encat{C}\otimes\encat{D}");
            math.ToTokenString().TestString(@"\encat{C}\otimes\encat{D}");
            math.OriginalText.Is(@"\encat{C}\otimes\encat{D}");
        }
Example #15
0
        public void Functor_変数無し()
        {
            var list = new List <Functor>()
            {
                Functor.Create("Fab", "Gba")
            };

            var right = new MathObjectFactory("Gba").CreateSingle();

            CreateTikZDiagram(list)
            .EqualsAsMathObject(new MathObjectFactory("Fab").CreateSingle(), right)
            .IsTrue();
            CreateTikZDiagram(list)
            .EqualsAsMathObject(new MathObjectFactory("Gba").CreateSingle(), right)
            .IsTrue();
            CreateTikZDiagram(list)
            .EqualsAsMathObject(new MathObjectFactory("F").CreateSingle(), right)
            .IsFalse();
        }
Example #16
0
        public void Functor_定数関手()
        {
            var list = new List <Functor>()
            {
                Functor.Create("F#1", "x")
            };

            var right = new MathObjectFactory("x").CreateSingle();

            CreateTikZDiagram(list)
            .EqualsAsMathObject(new MathObjectFactory("Fa").CreateSingle(), right)
            .IsTrue();
            CreateTikZDiagram(list)
            .EqualsAsMathObject(new MathObjectFactory("F(b)").CreateSingle(), right)
            .IsTrue();
            CreateTikZDiagram(list)
            .EqualsAsMathObject(new MathObjectFactory("F(uvw)").CreateSingle(), right)
            .IsTrue();
            CreateTikZDiagram(list)
            .EqualsAsMathObject(new MathObjectFactory("Fs").CreateSingle(), new MathObjectFactory("Ft").CreateSingle())
            .IsTrue();
        }
Example #17
0
        public void 複数生成()
        {
            var math = new MathObjectFactory("f, gh, ijk").Create().ToArray();

            math.Length.Is(3);
            math[0].IsMathToken("f");
            math[0].ToTokenString().TestString("f");
            math[0].OriginalText.Is("f");
            math[1].AsMathSequence().List.Count.Is(2);
            math[1].AsMathSequence().List[0].IsMathToken("g");
            math[1].AsMathSequence().List[1].IsMathToken("h");
            math[1].Main.TestString("gh");
            math[1].ToTokenString().TestString("gh");
            math[1].OriginalText.Is("gh");
            math[2].AsMathSequence().List.Count.Is(3);
            math[2].AsMathSequence().List[0].IsMathToken("i");
            math[2].AsMathSequence().List[1].IsMathToken("j");
            math[2].AsMathSequence().List[2].IsMathToken("k");
            math[2].Main.TestString("ijk");
            math[2].ToTokenString().TestString("ijk");
            math[2].OriginalText.Is("ijk");


            math = new MathObjectFactory(@"\alpha , \beta").Create().ToArray();
            math.Length.Is(2);
            math[0].IsMathToken(@"\alpha");
            math[0].ToTokenString().TestString(@"\alpha");
            math[0].OriginalText.Is(@"\alpha");
            math[1].IsMathToken(@"\beta");
            math[1].ToTokenString().TestString(@"\beta");
            math[1].OriginalText.Is(@"\beta");

            math = new MathObjectFactory("u=v").Create().ToArray();
            math.Length.Is(2);
            math[0].IsMathToken("u");
            math[0].ToTokenString().TestString("u");
            math[0].OriginalText.Is("u");
            math[1].IsMathToken("v");
            math[1].ToTokenString().TestString("v");
            math[1].OriginalText.Is("v");

            math = new MathObjectFactory(@"abc\, = \, def").Create().ToArray();
            math.Length.Is(2);
            math[0].AsMathSequence().List.Count.Is(3);
            math[0].Main.TestString("abc");
            math[0].ToTokenString().TestString("abc");
            math[0].OriginalText.Is("abc");
            math[1].AsMathSequence().List.Count.Is(3);
            math[1].Main.TestString("def");
            math[1].ToTokenString().TestString("def");
            math[1].OriginalText.Is(@"\, def");

            math = new MathObjectFactory(@"\beta_i\cong \gamma_j").Create().ToArray();
            math.Length.Is(2);
            math[0].AsMathSequence().List.Count.Is(1);
            math[0].Main.TestString(@"\beta");
            math[0].ToTokenString().TestString(@"\beta_i");
            math[0].OriginalText.Is(@"\beta_i");
            math[1].AsMathSequence().List.Count.Is(1);
            math[1].Main.TestString(@"\gamma");
            math[1].ToTokenString().TestString(@"\gamma_j");
            math[1].OriginalText.Is(@"\gamma_j");
        }