public void DetectErrorStates(string label) { var s = new TestScheduler(); var i = s.EvenlySpacedHot(10, 10, BadInput[label]); var a = s.LetRun(() => Perf.MapToFrame(i)); var r = Dbg.Errored(a.Messages); Assert.IsTrue(r, $"\n{Dbg.Show(a)}"); }
public void DeserializeFrame(int l) { var s = new TestScheduler(); var c = MapToFramesCases[l]; var i = s.EvenlySpacedHot(10, 10, c.Input.Concat(CloseBytes)); var e = new[] { c.Output, CloseFrame }; var a = s.LetRun(() => i.MapToFrame()); var r = a.GetValues(); Assert.IsTrue(e.SequenceEqual(r, WSFrame.ByCodeAndPayload) && Dbg.Completed(a.Messages), $"{Environment.NewLine}{Dbg.Show(a)}"); }
//[Ignore] public void MapFrameToByteBuffer(int l) { const int repeat = 3; var s = new TestScheduler(); var i = Enumerable.Repeat(MapToByteBufferCases[l].Input, repeat); var e = Enumerable.Repeat(MapToByteBufferCases[l].Output, repeat); var a = s.LetRun(() => s.EvenlySpacedHot(10, 10, i).Take(repeat) .MapToBuffer()); var r = a.GetValues(); Assert.IsTrue( condition: r.Count() == e.Count() && r.Zip(e, (act, exp) => act.SequenceEqual(exp)).All(x => x), message: Dbg.Show(a)); }
public void ValidateValidSequence() { var s = new TestScheduler(); var i = s.EvenlySpacedHot(10, 10, ValidSequence); var e = DefragmentedValidSequence; var a = s.LetRun(() => i.DefragmentData().Take(1)); var rs = a.GetValues(); Assert.IsTrue(rs.Count() == 1, Dbg.Show(a)); var r = rs.Single(); Assert.IsTrue( r.OpCode == e.OpCode && r.Payload.SequenceEqual(e.Payload), ShowError(a)); }