예제 #1
0
        public void WrapDouble()
        {
            IEqualityComparer <double> comparer = new ApproximateComparer(0.01);
            IByteBuffer buffer = CopyDouble(1, 4);

            Assert.Equal(16, buffer.Capacity);
            Assert.Equal(1, buffer.ReadDouble(), comparer);
            Assert.Equal(4, buffer.ReadDouble(), comparer);
            Assert.False(buffer.IsReadable());

            Assert.Equal(0, CopyDouble(null).Capacity);
            Assert.Equal(0, CopyDouble(new double[] { }).Capacity);
        }
예제 #2
0
        public void WrapFloat()
        {
            IEqualityComparer <float> comparer = new ApproximateComparer(0.01);
            IByteBuffer buffer = CopyFloat(1, 4);

            Assert.Equal(8, buffer.Capacity);
            Assert.Equal(1, buffer.ReadFloat(), comparer);
            Assert.Equal(4, buffer.ReadFloat(), comparer);
            Assert.False(buffer.IsReadable());

            Assert.Equal(0, CopyFloat(null).Capacity);
            Assert.Equal(0, CopyFloat(new float[] { }).Capacity);
        }