public void AscendingPriorityQueueClearTest() { AscendingPriorityQueue <int, int> priorityQueue = new AscendingPriorityQueue <int, int>(); Assert.AreEqual(0, priorityQueue.Size); priorityQueue.Clear(); Assert.AreEqual(0, priorityQueue.Size); priorityQueue.Insert(1, 11); priorityQueue.Insert(2, 22); Assert.AreEqual(2, priorityQueue.Size); priorityQueue.Clear(); Assert.AreEqual(0, priorityQueue.Size); }
public void AscendingPriorityQueueIsEmptyTest() { AscendingPriorityQueue <int, int> priorityQueue = new AscendingPriorityQueue <int, int>(); Assert.IsTrue(priorityQueue.IsEmpty); priorityQueue.Insert(1, 1); priorityQueue.Insert(2, 2); Assert.IsFalse(priorityQueue.IsEmpty); priorityQueue.Clear(); Assert.IsTrue(priorityQueue.IsEmpty); }
public void Measure(BigInteger measuredResult, BigInteger nextInput) { var remaining = _finishedHypotheses.Where(e => e.State.MayResult.ForceGetValue() == measuredResult).Concat(_runningHypotheses).ToArray(); _runningHypotheses.Clear(); _finishedHypotheses.Clear(); foreach (var hypothesis in remaining) { _runningHypotheses.Enqueue(new Hypothesis(hypothesis.Prior, hypothesis.State == null ? null : new TuringMachine(hypothesis.State.Instructions, nextInput), hypothesis.MaxSeenElapsedSteps)); } }