Commit 6e846a4c authored by Brickner_cp's avatar Brickner_cp

Code Coverage 96.22%

parent 12d1aa59
...@@ -243,6 +243,24 @@ namespace PcapDotNet.Base.Test ...@@ -243,6 +243,24 @@ namespace PcapDotNet.Base.Test
} }
} }
[TestMethod]
public void BitwiseOrTest()
{
const string ValueString = "0123456789ABCDEFFEDCBA9876543210";
UInt128 value = UInt128.Parse(ValueString, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
Assert.AreEqual(UInt128.Parse(ValueString, NumberStyles.HexNumber, CultureInfo.InvariantCulture), value);
for (int i = 0; i <= 32; ++i)
{
string orValueString = new string('0', i) + new string('F', ValueString.Length - i);
UInt128 orValue = UInt128.Parse("0" + orValueString, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
string expectedValueString = ValueString.Substring(0, i) + new string('F', ValueString.Length - i);
UInt128 expectedValue = UInt128.Parse(expectedValueString, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
UInt128 actualValue = value | orValue;
Assert.AreEqual(expectedValue, actualValue, i.ToString());
}
}
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void ParseNullTest() public void ParseNullTest()
......
...@@ -114,5 +114,21 @@ namespace PcapDotNet.Packets.Test ...@@ -114,5 +114,21 @@ namespace PcapDotNet.Packets.Test
Assert.IsNull(packet.Ethernet.FrameCheckSequence); Assert.IsNull(packet.Ethernet.FrameCheckSequence);
Assert.IsNull(packet.Ethernet.ExtraData); Assert.IsNull(packet.Ethernet.ExtraData);
} }
[TestMethod]
public void EmptyPadding()
{
Packet packet = PacketBuilder.Build(DateTime.Now,
new EthernetLayer
{
EtherType = EthernetType.AppleTalk
},
new PayloadLayer
{
Data = new Datagram(new byte[10])
});
Assert.IsTrue(packet.IsValid);
Assert.AreEqual(DataSegment.Empty, packet.Ethernet.Padding);
}
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment