예제 #1
0
 public void Reset()
 {
     Energy.Base.Counter counter1 = new Energy.Base.Counter();
     Assert.AreEqual(counter1.Overflow, false);
     counter1.Decrement();
     Assert.AreEqual(counter1.Overflow, true);
     counter1.Reset();
     Assert.AreEqual(counter1.Overflow, false);
 }
예제 #2
0
 public void Increment()
 {
     Energy.Base.Counter counter;
     counter = new Energy.Base.Counter(1, 3, 2);
     Assert.AreEqual(3, counter.Increment());
     Assert.IsFalse(counter.Overflow);
     Assert.AreEqual(3, counter.Increment());
     Assert.IsTrue(counter.Overflow);
     Assert.AreEqual(1, counter.Reset());
     Assert.IsFalse(counter.Overflow);
     Assert.AreEqual(3, counter.Increment(4));
     Assert.IsTrue(counter.Overflow);
     counter.Loop = true;
     Assert.AreEqual(1, counter.Increment());
     Assert.AreEqual(1, counter.Increment(3));
     Assert.AreEqual(2, counter.Increment(4));
 }