public void Day16_TestDecoder_GetLiteralValuePaket_OK() { string hexInput = "D2FE28"; var sut = new PaketDecoder(hexInput); var paket = sut.ParsePaket(); LiteralValue lv = paket as LiteralValue; Assert.Equal(6, lv.Version); Assert.Equal(4, lv.TypeID); Assert.Equal(2021, lv.Value); }
public void Day16_TestDecoder_GetOperatorPaket1_OK() { string hexInput = "EE00D40C823060"; var sut = new PaketDecoder(hexInput); var paket = sut.ParsePaket(); OperatorPacket op = paket as OperatorPacket; Assert.NotNull(op); Assert.Equal(7, op.Version); Assert.Equal(3, op.TypeID); Assert.True(op.Iflag); OperatorSubPackets olb = paket as OperatorSubPackets; Assert.NotNull(olb); Assert.Equal(3, olb.SubPackets); Assert.Equal(3, olb.Packets.Count); }
public void Day16_TestDecoder_GetOperatorPaket0_OK() { string hexInput = "38006F45291200"; var sut = new PaketDecoder(hexInput); var paket = sut.ParsePaket(); OperatorPacket op = paket as OperatorPacket; Assert.NotNull(op); Assert.Equal(1, op.Version); Assert.Equal(6, op.TypeID); Assert.False(op.Iflag); OperatorLenBits olb = paket as OperatorLenBits; Assert.NotNull(olb); Assert.Equal(27, olb.LenBits); Assert.Equal(2, olb.Packets.Count); }