Exemplo n.º 1
0
 public SortingTask(StreamReader reader)
 {
     _reader = reader;
     for (int i = 0; i < MaxCount; i++)
     {
         _list[i] = new CompositeString();
     }
 }
Exemplo n.º 2
0
            /// <summary>
            /// Return a byte array of the specified length
            /// </summary>
            /// <param name="Length"></param>
            /// <returns></returns>
            public static byte[] ValueAsByteArray(Int16 Length, string AdditionalSeed)
            {
                ASCIIEncoding enc = new ASCIIEncoding();
                String        CompositeString;

                CompositeString = AdditionalSeed.PadRight(32, "o".ToCharArray()[0]);

                return(enc.GetBytes(CompositeString.Substring(0, 32)));
            }
Exemplo n.º 3
0
        public static void FileSorted(string path, CompositeStringComparer comparer)
        {
            CompositeString prevComposite = new CompositeString();

            Assert.True(File.Exists(path));
            using (var reader = new StreamReader(path))
            {
                string          currentLine      = null;
                CompositeString currentComposite = new CompositeString();
                while ((currentLine = reader.ReadLine()) != null)
                {
                    currentComposite.Init(currentLine);
                    Assert.LessOrEqual(comparer.Compare(prevComposite, currentComposite), 0);
                    prevComposite = currentComposite;
                }
            }
        }