Author: alanmc
Date: 2008-02-16 20:25:58 -0500 (Sat, 16 Feb 2008)
New Revision: 95950
Modified:
trunk/bitsharp/src/MonoTorrent.Tests/PeerMessagesTest.cs
Log:
Updated the handshake message tests to use the new boolean for
ExtendedMessaging. Updated the PieceMessage test so it passes. This uses the
new PieceWriter code
Modified: trunk/bitsharp/src/MonoTorrent.Tests/PeerMessagesTest.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent.Tests/PeerMessagesTest.cs 2008-02-17
01:24:37 UTC (rev 95949)
+++ trunk/bitsharp/src/MonoTorrent.Tests/PeerMessagesTest.cs 2008-02-17
01:25:58 UTC (rev 95950)
@@ -127,7 +127,7 @@
public void HandshakeEncoding()
{
byte[] infohash = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 0, 12, 15, 12, 52 };
- int length = new HandshakeMessage(infohash,
"12312312345645645678", VersionInfo.ProtocolStringV100, false).Encode(buffer,
offset);
+ int length = new HandshakeMessage(infohash,
"12312312345645645678", VersionInfo.ProtocolStringV100, false,
false).Encode(buffer, offset);
Console.WriteLine(BitConverter.ToString(buffer, offset, length));
byte[] peerId = Encoding.ASCII.GetBytes("12312312345645645678");
@@ -139,7 +139,7 @@
Assert.IsTrue(Toolbox.ByteMatch(peerId, 0, buffer, offset + 48,
20), "5");
Assert.AreEqual(length, 68, "6");
- length = new HandshakeMessage(infohash, "12312312345645645678",
VersionInfo.ProtocolStringV100, true).Encode(buffer, offset);
+ length = new HandshakeMessage(infohash, "12312312345645645678",
VersionInfo.ProtocolStringV100, true, false).Encode(buffer, offset);
Assert.AreEqual(BitConverter.ToString(buffer, offset, length),
"13-42-69-74-54-6F-72-72-65-6E-74-20-70-72-6F-74-6F-63-6F-6C-00-00-00-00-00-00-00-04-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-00-0C-0F-0C-34-31-32-33-31-32-33-31-32-33-34-35-36-34-35-36-34-35-36-37-38",
"#7");
}
@@ -271,7 +271,7 @@
private void EncodeDecode(Message orig)
{
orig.Encode(buffer, offset);
- Message dec = PeerMessage.DecodeMessage(buffer, offset + 4, 1000,
null); // We need the +4 to skip past the message length bytes
+ Message dec = PeerMessage.DecodeMessage(buffer, offset + 4, 798,
null); // We need the +4 to skip past the message length bytes
Assert.IsTrue(orig.Equals(dec), string.Format("orig: {0}, new:
{1}", orig, dec));
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches