1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-16 15:16:33 +09:00

NetBitVector enhanced

This commit is contained in:
lidgren
2010-09-24 18:26:01 +00:00
parent a579ff8f4b
commit c485a2d02c
2 changed files with 70 additions and 13 deletions

View File

@@ -32,7 +32,36 @@ namespace UnitTests
if (f != i)
throw new NetException("bit vector fail 4");
}
v = new NetBitVector(9);
v.Clear();
v.Set(3, true);
if (v.ToString() != "[000001000]")
throw new NetException("NetBitVector.RotateDown failed");
v.RotateDown();
if (v.Get(3) == true || v.Get(2) == false || v.Get(4) == true)
throw new NetException("NetBitVector.RotateDown failed 2");
if (v.ToString() != "[000000100]")
throw new NetException("NetBitVector.RotateDown failed 3");
v.Set(0, true);
v.RotateDown();
if (v.ToString() != "[100000010]")
throw new NetException("NetBitVector.RotateDown failed 4");
v = new NetBitVector(38);
v.Set(0, true);
v.Set(1, true);
v.Set(31, true);
if (v.ToString() != "[00000010000000000000000000000000000011]")
throw new NetException("NetBitVector.RotateDown failed 5");
v.RotateDown();
if (v.ToString() != "[10000001000000000000000000000000000001]")
throw new NetException("NetBitVector.RotateDown failed 5");
Console.WriteLine("NetBitVector tests OK");
}
}