예제 #1
0
        public void TryUnpack_DoubleInifinity()
        {
            var m = new DoubleMarshaller();

            Assert.True(m.TryUnpack("-Infinity", out double actual));

            Assert.AreEqual(double.NegativeInfinity, actual);
        }
예제 #2
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);
        }