예제 #1
0
        public void FlatScalar()
        {
            //a flat struct of scalar values:
            //boolean:true
            //str:"yes"
            //integer:123456
            //longInt:int.Max*2
            //bigInt:long.Max*10
            //double:2213.1267567f
            var flatScalar = DirStructure.OwnTestFileAsBytes("binary/flat_scalar.bindat");

            var reader = new UserBinaryReader(new MemoryStream(flatScalar));
            ReaderTestCommon.FlatScalar(reader);
        }
예제 #2
0
        public void FlatScalar()
        {
            //a flat struct of scalar values:
            //boolean:true
            //str:"yes"
            //integer:123456
            //longInt:int.Max*2
            //bigInt:long.Max*10
            //double:2213.1267567f
            var flatScalar = DirStructure.OwnTestFileAsBytes("text/flat_scalar.ion");

            var reader = new UserTextReader(new MemoryStream(flatScalar));

            ReaderTestCommon.FlatScalar(reader);

            reader = new UserTextReader(Encoding.UTF8.GetString(flatScalar));
            ReaderTestCommon.FlatScalar(reader);
        }
예제 #3
0
        public void FlatStructScalarTest()
        {
            //Must be a flat struct of scalar values:
            //boolean:true
            //str:"yes"
            //integer:123456
            //longInt:int.Max*2
            //bigInt:long.Max*10
            //double:2213.1267567f
            var value = new IonStruct
            {
                { "boolean", _ionValueFactory.NewBool(true) },
                { "str", _ionValueFactory.NewString("yes") },
                { "integer", _ionValueFactory.NewInt(123456) },
                { "longInt", _ionValueFactory.NewInt((long)int.MaxValue * 2) },
                { "bigInt", _ionValueFactory.NewInt(BigInteger.Multiply(new BigInteger(long.MaxValue), 10)) },
                { "double", _ionValueFactory.NewFloat(2213.1267567) }
            };
            var reader = new UserTreeReader(value);

            ReaderTestCommon.FlatScalar(reader);
        }