/// <summary> /// Merge method /// </summary> public void Merge(PNCounter pNCounter) { for (int i = 0; i < 10; i++) { this.PState[i] = Math.Max(this.PState[i], pNCounter.PState[i]); this.NState[i] = Math.Max(this.NState[i], pNCounter.NState[i]); } }
public void PNCounterTest() { PNCounter replica1 = new PNCounter(1); PNCounter replica2 = new PNCounter(2); replica1.Increment(); replica2.Decrement(); replica2.Decrement(); replica1.Merge(replica2); Assert.AreEqual(-1, replica1.Query()); }