Example #1
0
        public void ClearList()
        {
            List <int> numbers = List354();

            DataUtil.Clear(numbers);
            Assert.AreEqual(0, DataUtil.Length(numbers));
        }
Example #2
0
        public void ClearListAtMiddle()
        {
            List <int> numbers = List354();

            DataUtil.Clear(numbers, 1);
            Assert.AreEqual(1, DataUtil.Length(numbers));
            Assert.AreEqual("3",
                            DataUtil.Join(numbers, ", "));
        }
Example #3
0
        public void ClearListAtEnd()
        {
            List <int> numbers = List354();

            DataUtil.Clear(numbers, 2);
            Assert.AreEqual(2, DataUtil.Length(numbers));
            Assert.AreEqual("3, 5",
                            DataUtil.Join(numbers, ", "));
        }
Example #4
0
 // Example:  Editor/Tests/TestProgress.cs
 public void SetupIndexes(int length, int start = 0)
 {
     indexesLength = length;
     indexesStart  = start;
     DataUtil.Clear(indexes);
     for (int index = start; index < length; index++)
     {
         indexes.Add(index);
     }
     levelMax = length;
 }
Example #5
0
 // Example: TestAnagramJournal.cs
 public void Read(string historyTsv)
 {
     string[][] table = StringUtil.ParseCsv(historyTsv, "\t");
     DataUtil.Clear(playbackDelays);
     DataUtil.Clear(playbackActions);
     if ("delay" != table[0][0] || "action" != table[0][1])
     {
         throw new System.InvalidOperationException("Expected delay and action as headers."
                                                    + " Got " + table[0][0] + ", " + table[0][1]);
     }
     for (int rowIndex = 1; rowIndex < DataUtil.Length(table); rowIndex++)
     {
         string[] row   = table[rowIndex];
         int      delay = StringUtil.ParseInt(row[0]);
         playbackDelays.Add(delay);
         string action = row[1];
         playbackActions.Add(action);
     }
 }