public void TrackingModuleTest() { RUDPDeliverTrackingModule trackingModule = new RUDPDeliverTrackingModule(); ushort seed = 65520; ushort payloadsCount = 0; trackingModule.Reset(65520); for (ushort i = seed; i != 20; i++) { RUDPPayload newPayload = new RUDPPayload(RUDPPayload.PAYLOAD_TAG.DELIVERY_NOFIFY, 0); newPayload.Packet = this.emptyPacket; trackingModule.PrepareToDeliver(newPayload); payloadsCount++; } // 몇가지 Seq를 뺀 Ack를 만들어서 trackingModule에서 Ack를 처리하게 해야함 // 그리고 결과를 처음 빠트린 Ack와 정상 ACk와 일치하는지 검증 ushort halfPoint = seed; halfPoint += (ushort)(payloadsCount / 2); AckRange ackR = new AckRange(halfPoint, (ushort)(payloadsCount / 2)); trackingModule.ProcessAckRange(ackR); ushort[] success = trackingModule.GetAndClearSuccessPayloadSeqNums(); ushort[] fail = trackingModule.GetAndClearLossPayloadSeqNums(); Assert.IsTrue(ackR.AckCount == success.Length); Assert.IsTrue((payloadsCount - ackR.AckCount) == fail.Length); for (int i = 0; i < ackR.AckCount; i++) //성공한 Ack { Assert.IsTrue((ackR.StartNum + i) == success[i]); } ushort start = seed; for (ushort i = 0; i < (payloadsCount - ackR.AckCount); i++) //실패한 Ack { Assert.IsTrue((ushort)start == fail[i]); start++; } }