public void TestFlatBufferConsistency() { var random = new Random(); var recorder = new FlatBufferRecorder(); var replayer = new FlatBufferReplayer(); var schema = new MessageSchema(); schema.Register(1, SynchronizeSceneData.GetRootAsSynchronizeSceneData); var processor = new MessageProcessor(schema); processor.Attach(1, msg => OnProcessMessage(recorder, replayer, msg)); for (var time = 0; time < TotalRunTime; time += RecordInterval) { var fbb = RandomRecord(random, recorder, time); if (fbb != null) { var bytes = FlatBufferExtensions.ToProtocolMessage(fbb, 1); processor.Enqueue(bytes); processor.Process(); } } }
private void OnProcessMessage(FlatBufferRecorder recorder, FlatBufferReplayer replayer, Message message) { var data = (SynchronizeSceneData)message.Body; replayer.Replay(data.StartTime, data.EndTime, data); for (var frameTime = data.StartTime; frameTime < data.EndTime; frameTime += ReplayInterval) { var recorderFrame = GetFrameData(recorder.Scene, frameTime); var replayerFrame = GetFrameData(replayer.Scene, frameTime); CompareFrameData(recorderFrame, replayerFrame); } }