コード例 #1
0
        public void TryPackUnpack_DoubleArray()
        {
            var m     = new DoubleMarshaller();
            var data1 = new double[] { };
            var data2 = new double[] { 1.1 };
            var data3 = new double[] { 1.1, 2.2, 3.3 };

            Assert.True(m.TryPack(data1, out ConfigValue result1));
            Assert.True(m.TryPack(data2, out ConfigValue result2));
            Assert.True(m.TryPack(data3, out ConfigValue result3));

            Assert.True(m.TryUnpack(result1, typeof(double), out object actualData1));
            Assert.True(m.TryUnpack(result2, typeof(double), out object actualData2));
            Assert.True(m.TryUnpack(result3, typeof(double), out object actualData3));

            Assert.AreEqual(data1, actualData1);
            Assert.AreEqual(data2, actualData2);
            Assert.AreEqual(data3, actualData3);
        }
コード例 #2
0
        public void TryPack_DoubleInifinity()
        {
            var m = new DoubleMarshaller();

            Assert.True(m.TryPack(double.NegativeInfinity, out ConfigValue result));

            var actual   = result.Value;
            var expected = "-Infinity";

            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void TryPack_DoubleNaN()
        {
            var m = new DoubleMarshaller();

            Assert.True(m.TryPack(double.NaN, out ConfigValue result));

            var actual   = result.Value;
            var expected = "NaN";

            Assert.AreEqual(expected, actual);
        }
コード例 #4
0
        public void TryPack_DoubleArray()
        {
            var m = new DoubleMarshaller();

            m.TryPack(new double[] { -1, 2, 3.4, 4.59, 0 }, out ConfigValue result);

            var actual   = result.Value;
            var expected = "-1 2 3.4 4.59 0";

            Assert.AreEqual(expected, actual);
        }