예제 #1
0
        public void FormatRubpy3Cl2()
        {
            var tokens = new List <string>();

            Assert.IsTrue(AbbreviationLabel.Parse("Ru(bpy)3Cl2", tokens));
            var formatted = AbbreviationLabel.Format(tokens);

            AbbreviationLabel.Reduce(formatted, 0, formatted.Count);
            Assert.AreEqual("Ru(bpy)", formatted[0].Text);
            Assert.AreEqual(0, formatted[0].Style);
            Assert.AreEqual("3", formatted[1].Text);
            Assert.AreEqual(-1, formatted[1].Style);
            Assert.AreEqual("Cl", formatted[2].Text);
            Assert.AreEqual(0, formatted[2].Style);
            Assert.AreEqual("2", formatted[3].Text);
            Assert.AreEqual(-1, formatted[3].Style);
        }
예제 #2
0
        public void NEt3DotHCl()
        {
            List <string> tokens = new List <string>();

            Assert.IsTrue(AbbreviationLabel.Parse("NEt3·HCl", tokens));
            Assert.AreEqual(5, tokens.Count);
            Assert.AreEqual("N", tokens[0]);
            Assert.AreEqual("Et3", tokens[1]);
            Assert.AreEqual("·", tokens[2]);
            Assert.AreEqual("H", tokens[3]);
            Assert.AreEqual("Cl", tokens[4]);
            List <AbbreviationLabel.FormattedText> formatted = AbbreviationLabel.Format(tokens);

            AbbreviationLabel.Reduce(formatted, 0, formatted.Count);
            Assert.AreEqual(3, formatted.Count);
            Assert.AreEqual("NEt", formatted[0].Text);
            Assert.AreEqual(AbbreviationLabel.STYLE_NORMAL, formatted[0].Style);
            Assert.AreEqual("3", formatted[1].Text);
            Assert.AreEqual(AbbreviationLabel.STYLE_SUBSCRIPT, formatted[1].Style);
            Assert.AreEqual("·HCl", formatted[2].Text);
            Assert.AreEqual(AbbreviationLabel.STYLE_NORMAL, formatted[2].Style);
        }