Пример #1
0
        public void AlphaCompNumberString()
        {
            string      zero    = XmlViewsUtils.AlphaCompNumberString(0);
            string      one     = XmlViewsUtils.AlphaCompNumberString(1);
            string      two     = XmlViewsUtils.AlphaCompNumberString(2);
            string      ten     = XmlViewsUtils.AlphaCompNumberString(10);
            string      eleven  = XmlViewsUtils.AlphaCompNumberString(11);
            string      hundred = XmlViewsUtils.AlphaCompNumberString(100);
            string      minus1  = XmlViewsUtils.AlphaCompNumberString(-1);
            string      minus2  = XmlViewsUtils.AlphaCompNumberString(-2);
            string      minus10 = XmlViewsUtils.AlphaCompNumberString(-10);
            string      max     = XmlViewsUtils.AlphaCompNumberString(Int32.MaxValue);
            string      min     = XmlViewsUtils.AlphaCompNumberString(Int32.MinValue);
            IcuComparer comp    = new IcuComparer("en");

            comp.OpenCollatingEngine();
            Assert.IsTrue(comp.Compare(zero, one) < 0);
            Assert.IsTrue(comp.Compare(one, two) < 0);
            Assert.IsTrue(comp.Compare(two, ten) < 0);
            Assert.IsTrue(comp.Compare(ten, eleven) < 0);
            Assert.IsTrue(comp.Compare(eleven, hundred) < 0);
            Assert.IsTrue(comp.Compare(minus1, zero) < 0);
            Assert.IsTrue(comp.Compare(minus2, minus1) < 0);
            Assert.IsTrue(comp.Compare(minus10, minus2) < 0);
            Assert.IsTrue(comp.Compare(hundred, max) < 0);
            Assert.IsTrue(comp.Compare(min, minus10) < 0);

            Assert.IsTrue(comp.Compare(ten, zero) > 0);
            Assert.IsTrue(comp.Compare(ten, minus1) > 0);
            Assert.IsTrue(comp.Compare(hundred, minus10) > 0);
            Assert.IsTrue(comp.Compare(one, one) == 0);
            Assert.IsTrue(comp.Compare(ten, ten) == 0);
            Assert.IsTrue(comp.Compare(minus1, minus1) == 0);
            comp.CloseCollatingEngine();
        }