コード例 #1
0
        public void TestCompareVersionNumbers()
        {
            var r = CompareVersionNumbers.Compare("0.1", "1.1");

            Assert.AreEqual(r, -1);

            r = CompareVersionNumbers.Compare("1.0.1", "1");
            Assert.AreEqual(r, 1);

            r = CompareVersionNumbers.Compare("7.5.2.4", "7.5.3");
            Assert.AreEqual(r, -1);

            r = CompareVersionNumbers.Compare("1.01.1", "1.0001.1");
            Assert.AreEqual(r, 0);

            r = CompareVersionNumbers.Compare("1.0.0", "1.0");
            Assert.AreEqual(r, 0);
        }
コード例 #2
0
        public void Example1()
        {
            var sol = new CompareVersionNumbers();

            Assert.AreEqual(-1, sol.CompareVersion("0.1", "1.1"));
        }
コード例 #3
0
        public void Example5()
        {
            var sol = new CompareVersionNumbers();

            Assert.AreEqual(0, sol.CompareVersion("1.0", "1.0.0"));
        }
コード例 #4
0
        public void Example6()
        {
            var sol = new CompareVersionNumbers();

            Assert.AreEqual(-1, sol.CompareVersion("2.9.9.9", "10.0.0"));
        }
コード例 #5
0
        public void Example3()
        {
            var sol = new CompareVersionNumbers();

            Assert.AreEqual(-1, sol.CompareVersion("7.5.2.4", "7.5.3"));
        }