Ejemplo n.º 1
0
        public void display_successors_samples(string v)
        {
            ReleaseTagVersion t = ReleaseTagVersion.TryParse(v);
            var succ            = t.GetDirectSuccessors(false);

            Console.WriteLine(" -> - found {0} successors for '{1}' (Ordered Version = {2}, File = {3}):",
                              succ.Count(),
                              t,
                              t.OrderedVersion,
                              t.ToStringFileVersion(false));
            Console.WriteLine("      " + string.Join(", ", succ.Select(s => s.ToString())));

            var closest = t.GetDirectSuccessors(true).Select(s => s.ToString()).ToList();

            Console.WriteLine("    - {0} next fixes:", closest.Count, t);
            Console.WriteLine("      " + string.Join(", ", closest));
        }
Ejemplo n.º 2
0
        //static int _greatersuccessorCount = 0;

        ReleaseTagVersion CheckMapping(long v)
        {
            if (v < 0 || v > ReleaseTagVersion.VeryLastVersion.OrderedVersion)
            {
                Assert.Throws <ArgumentException>(() => new ReleaseTagVersion(v));
                return(null);
            }
            var t = new ReleaseTagVersion(v);

            Assert.That((v == 0) == !t.IsValid);
            Assert.That(t.OrderedVersion, Is.EqualTo(v));
            var sSemVer     = t.ToString(ReleaseTagFormat.SemVer);
            var tSemVer     = ReleaseTagVersion.TryParse(sSemVer);
            var tNormalized = ReleaseTagVersion.TryParse(t.ToString(ReleaseTagFormat.Normalized));

            Assert.That(tSemVer.OrderedVersion, Is.EqualTo(v));
            Assert.That(tNormalized.OrderedVersion, Is.EqualTo(v));
            Assert.That(tNormalized.Equals(t));
            Assert.That(tSemVer.Equals(t));
            Assert.That(tNormalized.Equals((object)t));
            Assert.That(tSemVer.Equals((object)t));
            Assert.That(tNormalized.CompareTo(t) == 0);
            Assert.That(tSemVer == t);
            Assert.That(tSemVer.ToString(), Is.EqualTo(t.ToString()));
            Assert.That(tNormalized.ToString(), Is.EqualTo(t.ToString()));
            // Successors/Predecessors check.
            var vSemVer = SemVersion.Parse(sSemVer, true);
            int count   = 0;

            foreach (var succ in t.GetDirectSuccessors(false))
            {
                ++count;
                Assert.That(succ.IsDirectPredecessor(t));
                var vSemVerSucc = SemVersion.Parse(succ.ToString(ReleaseTagFormat.SemVer));
                Assert.That(vSemVer < vSemVerSucc, "{0} < {1}", vSemVer, vSemVerSucc);
            }
            //if( count > _greatersuccessorCount )
            //{
            //    Console.WriteLine( " -> - found {0} successors for '{1}':", count, t );
            //    Console.WriteLine( "      " + string.Join( ", ", t.GetDirectSuccessors( false ).Select( s => s.ToString() ) ) );
            //    var closest = t.GetDirectSuccessors( true ).Select( s => s.ToString() ).ToList();
            //    Console.WriteLine( "    - {0} closest successors:", closest.Count, t );
            //    Console.WriteLine( "      " + string.Join( ", ", closest ) );
            //    _greatersuccessorCount = count;
            //}
            return(t);
        }
Ejemplo n.º 3
0
        public void display_name_and_successors_samples(string v)
        {
            ReleaseTagVersion t = ReleaseTagVersion.TryParse(v);
            var succ            = t.GetDirectSuccessors(false);

            Console.WriteLine(" -> - found {0} successors for '{1}' (NuGetV2 = {2}, Ordered Version = {3}, File = {4}.{5}.{6}.{7}):",
                              succ.Count(),
                              t,
                              t.ToString(ReleaseTagFormat.NugetPackageV2),
                              t.OrderedVersion,
                              t.OrderedVersionMajor,
                              t.OrderedVersionMinor,
                              t.OrderedVersionBuild,
                              t.OrderedVersionRevision
                              );
            Console.WriteLine("      " + string.Join(", ", succ.Select(s => s.ToString())));
        }
Ejemplo n.º 4
0
        //static int _greatersuccessorCount = 0;

        ReleaseTagVersion CheckMapping( long v )
        {
            if( v < 0 || v > ReleaseTagVersion.VeryLastVersion.OrderedVersion )
            {
                Assert.Throws<ArgumentException>( () => new ReleaseTagVersion( v ) );
                return null;
            }
            var t = new ReleaseTagVersion( v );
            Assert.That( (v == 0) == !t.IsValid );
            Assert.That( t.OrderedVersion, Is.EqualTo( v ) );
            var sSemVer = t.ToString( ReleaseTagFormat.SemVer );
            var tSemVer = ReleaseTagVersion.TryParse( sSemVer );
            var tNormalized = ReleaseTagVersion.TryParse( t.ToString( ReleaseTagFormat.Normalized ) );
            Assert.That( tSemVer.OrderedVersion, Is.EqualTo( v ) );
            Assert.That( tNormalized.OrderedVersion, Is.EqualTo( v ) );
            Assert.That( tNormalized.Equals( t ) );
            Assert.That( tSemVer.Equals( t ) );
            Assert.That( tNormalized.Equals( (object)t ) );
            Assert.That( tSemVer.Equals( (object)t ) );
            Assert.That( tNormalized.CompareTo( t ) == 0 );
            Assert.That( tSemVer == t );
            Assert.That( tSemVer.ToString(), Is.EqualTo( t.ToString() ) );
            Assert.That( tNormalized.ToString(), Is.EqualTo( t.ToString() ) );
            // Successors/Predecessors check.
            var vSemVer = SemVersion.Parse( sSemVer, true );
            int count = 0;
            foreach( var succ in t.GetDirectSuccessors( false ) )
            {
                ++count;
                Assert.That( succ.IsDirectPredecessor( t ) );
                var vSemVerSucc = SemVersion.Parse( succ.ToString( ReleaseTagFormat.SemVer ) );
                Assert.That( vSemVer < vSemVerSucc, "{0} < {1}", vSemVer, vSemVerSucc );
            }
            //if( count > _greatersuccessorCount )
            //{
            //    Console.WriteLine( " -> - found {0} successors for '{1}':", count, t );
            //    Console.WriteLine( "      " + string.Join( ", ", t.GetDirectSuccessors( false ).Select( s => s.ToString() ) ) );
            //    var closest = t.GetDirectSuccessors( true ).Select( s => s.ToString() ).ToList();
            //    Console.WriteLine( "    - {0} closest successors:", closest.Count, t );
            //    Console.WriteLine( "      " + string.Join( ", ", closest ) );
            //    _greatersuccessorCount = count;
            //}
            return t;
        }