Ejemplo 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));
            }
        }
Ejemplo n.º 2
0
        public void Issue1076()
        {
            var v0 = new ModuleVersion("1.01");
            var v1 = new ModuleVersion("1.1");

            Assert.That(v1.IsEqualTo(v0));
        }
Ejemplo n.º 3
0
        public void DifferentEpochs()
        {
            var v1 = new ModuleVersion("1:1");
            var v2 = new ModuleVersion("2:1");

            Assert.That(!v1.IsEqualTo(v2));
        }
Ejemplo n.º 4
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));
        }
Ejemplo n.º 5
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));
        }
Ejemplo n.º 6
0
 public static JToken ToSpecVersionJson(this ModuleVersion specVersion)
 {
     if (specVersion.IsEqualTo(new ModuleVersion("v1.0")))
     {
         return(1);
     }
     else
     {
         return(specVersion.ToString());
     }
 }