Пример #1
0
 public void ClientEnqueue(FakePacket packet, string address, int port)
 {
     recvQueue.Enqueue(new FakeData()
     {
         data = packet.GetData(), endPoint = new FakeEndPoint(address, port)
     });
 }
Пример #2
0
        public void TestSumBTooBig()
        {
            FakePacket packet = new FakePacket(0, 0.0f, float.MaxValue * 2.0f);

            transport.ClientEnqueue(packet, "tester", 0);

            Assert.That(() => server.SingleStep(), Throws.InstanceOf <ServerException>());
        }
Пример #3
0
        public void TestDivByZero()
        {
            FakePacket packet = new FakePacket(3, 10.0f, 0.0f);

            transport.ClientEnqueue(packet, "tester", 0);

            Assert.That(() => server.SingleStep(), Throws.InstanceOf <ServerException>());
        }
Пример #4
0
        public void TestDivMinValue()
        {
            FakePacket packet = new FakePacket(3, float.MinValue, 0.1f);

            transport.ClientEnqueue(packet, "tester", 0);

            Assert.That(() => server.SingleStep(), Throws.InstanceOf <ServerException>());
        }
Пример #5
0
        public void TestSumNegativePositive()
        {
            FakePacket packet = new FakePacket(0, -2.0f, 3.0f);

            transport.ClientEnqueue(packet, "tester", 0);
            server.SingleStep();

            float output = BitConverter.ToSingle(transport.ClientDequeue().data, 0);

            Assert.That(output, Is.EqualTo(1.0f));
        }
Пример #6
0
        public void TestMulNegativeNegative()
        {
            FakePacket packet = new FakePacket(2, -5.0f, -4.0f);

            transport.ClientEnqueue(packet, "tester", 0);
            server.SingleStep();

            float output = BitConverter.ToSingle(transport.ClientDequeue().data, 0);

            Assert.That(output, Is.EqualTo(20.0f));
        }