Esempio n. 1
0
        /// <summary>
        /// Returns whether the given constraint matches the desired version
        /// for the mod we're processing.
        /// </summary>
        private static bool ConstraintPasses(string op, ModuleVersion version, ModuleVersion desiredVersion)
        {
            switch (op)
            {
            case "":
            case "=":
                return(version.IsEqualTo(desiredVersion));

            case "<":
                return(version.IsLessThan(desiredVersion));

            case ">":
                return(version.IsGreaterThan(desiredVersion));

            case "<=":
                return(version.CompareTo(desiredVersion) <= 0);

            case ">=":
                return(version.CompareTo(desiredVersion) >= 0);

            default:
                throw new Kraken(
                          string.Format("Unknown x_netkan_override comparator: {0}", op));
            }
        }
Esempio n. 2
0
        public void Epoch()
        {
            var v1 = new ModuleVersion("1.2.0");
            var v2 = new ModuleVersion("1:1.2.0");

            Assert.That(v1.IsLessThan(v2));
        }
Esempio n. 3
0
        public void Alpha()
        {
            var v1 = new ModuleVersion("apple");
            var v2 = new ModuleVersion("banana");

            // alphabetical test
            Assert.That(v1.IsLessThan(v2));
        }
Esempio n. 4
0
        public void UnevenVersioning()
        {
            var v0 = new ModuleVersion("1.1.0.0");
            var v1 = new ModuleVersion("1.1.1");

            Assert.That(v0.IsLessThan(v1));
            Assert.That(v1.IsGreaterThan(v0));
        }
Esempio n. 5
0
        public void SortAllNonNumbersBeforeDot()
        {
            var v0 = new ModuleVersion("1.0_beta");
            var v1 = new ModuleVersion("1.0.1_beta");

            Assert.That(v0.IsLessThan(v1));
            Assert.That(v1.IsGreaterThan(v0));
        }
Esempio n. 6
0
        public void Complex()
        {
            var v1 = new ModuleVersion("v6a12");
            var v2 = new ModuleVersion("v6a5");

            Assert.That(v2.IsLessThan(v1));
            Assert.That(v1.IsGreaterThan(v2));
            Assert.That(!v1.IsEqualTo(v2));
        }
Esempio n. 7
0
        public void Basic()
        {
            var v0 = new ModuleVersion("1.2.0");
            var v1 = new ModuleVersion("1.2.0");
            var v2 = new ModuleVersion("1.2.1");

            Assert.That(v1.IsLessThan(v2));
            Assert.That(v2.IsGreaterThan(v1));
            Assert.That(v1.IsEqualTo(v0));
        }
Esempio n. 8
0
        public void DotSeparatorForExtraData()
        {
            var v0 = new ModuleVersion("1.0");
            var v1 = new ModuleVersion("1.0.repackaged");
            var v2 = new ModuleVersion("1.0.1");

            Assert.That(v0.IsLessThan(v1));
            Assert.That(v1.IsLessThan(v2));
            Assert.That(v1.IsGreaterThan(v0));
            Assert.That(v2.IsGreaterThan(v1));
        }