Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pcap-Net
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Pcap-Net
Commits
6e846a4c
Commit
6e846a4c
authored
Jan 17, 2015
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code Coverage 96.22%
parent
12d1aa59
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
UInt128Tests.cs
PcapDotNet/src/PcapDotNet.Base.Test/UInt128Tests.cs
+18
-0
EthernetTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/EthernetTests.cs
+16
-0
No files found.
PcapDotNet/src/PcapDotNet.Base.Test/UInt128Tests.cs
View file @
6e846a4c
...
@@ -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
()
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/EthernetTests.cs
View file @
6e846a4c
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment