Example #1
0
        static void WriteInfo(bool showStats = false)
        {
            Console.WriteLine();
#if DEBUG
            foreach (var lx in set.GenerateTreeText())
            {
                Console.WriteLine(lx);
            }

            set.SanityCheck();
            Console.WriteLine();

            if (showStats)
            {
                Console.WriteLine(set.GetTreeStatsText());
                Console.WriteLine();
            }
#endif
        }
Example #2
0
        static void Main()
        {
            for (int width = 1; ; ++width)
            {
                Console.Write(width + " ");
                for (int count = 0; count <= width; ++count)
                {
                    for (int index = 0; index <= width - count; ++index)
                    {
                        for (int order = 4; order <= 7; ++order)
                        {
                            set = new RankedSet <int> {
                                Capacity = order
                            };
                            for (int ii = 0; ii < width; ++ii)
                            {
                                set.Add(ii);
                            }

                            try
                            {
                                set.RemoveRange(index, count);

                                Debug.Assert(set.Count == width - count);
                                Debug.Assert(set.Count == set.Count());
                                Debug.Assert(set.Count == set.Reverse().Count());
#if DEBUG
                                set.SanityCheck();
#endif
                            }
                            catch (Exception)
                            {
                                Console.WriteLine($"\nwidth={width}, index={index}, count={count}, order={order}");
                                throw;
                            }
                        }
                    }
                }
            }
        }