Exemplo n.º 1
0
 public static VectorOffset CreateTmVector(FlatBufferBuilder builder, ulong[] data)
 {
     builder.StartVector(8, data.Length, 8); for (int i = data.Length - 1; i >= 0; i--)
     {
         builder.AddUlong(data[i]);
     }
     return(builder.EndVector());
 }
Exemplo n.º 2
0
        public void TestNumbers64()
        {
            var builder = new FlatBufferBuilder(1);
            builder.AddUlong(0x1122334455667788);
            Assert.ArrayEqual(new byte[] { 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11 }, builder.DataBuffer.Data);

            builder = new FlatBufferBuilder(1);
            builder.AddLong(0x1122334455667788);
            Assert.ArrayEqual(new byte[] { 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11 }, builder.DataBuffer.Data);
        }
Exemplo n.º 3
0
        public void TestNumbers64()
        {
            var builder = new FlatBufferBuilder(1);

            builder.AddUlong(0x1122334455667788);
            Assert.ArrayEqual(new byte[] { 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11 }, builder.DataBuffer.ToFullArray());

            builder = new FlatBufferBuilder(1);
            builder.AddLong(0x1122334455667788);
            Assert.ArrayEqual(new byte[] { 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11 }, builder.DataBuffer.ToFullArray());
        }
 public static void AddU64(FlatBufferBuilder builder, ulong u64)
 {
     builder.AddUlong(7, u64, 0);
 }
Exemplo n.º 5
0
        private void CheckObjects(int fieldCount, int objectCount)
        {
            _lcg.Reset();

            const int testValuesMax = 11;

            var builder = new FlatBufferBuilder(1);

            var objects = new int[objectCount];

            for (var i = 0; i < objectCount; ++i)
            {
                builder.StartObject(fieldCount);

                for (var j = 0; j < fieldCount; ++j)
                {
                    var fieldType = _lcg.Next()%testValuesMax;

                    switch (fieldType)
                    {
                        case 0:
                        {
                            builder.AddBool(j, FuzzTestData.BoolValue, false);
                            break;
                        }
                        case 1:
                        {
                            builder.AddSbyte(j, FuzzTestData.Int8Value, 0);
                            break;
                        }
                        case 2:
                        {
                            builder.AddByte(j, FuzzTestData.UInt8Value, 0);
                            break;
                        }
                        case 3:
                        {
                            builder.AddShort(j, FuzzTestData.Int16Value, 0);
                            break;
                        }
                        case 4:
                        {
                            builder.AddUshort(j, FuzzTestData.UInt16Value, 0);
                            break;
                        }
                        case 5:
                        {
                            builder.AddInt(j, FuzzTestData.Int32Value, 0);
                            break;
                        }
                        case 6:
                        {
                            builder.AddUint(j, FuzzTestData.UInt32Value, 0);
                            break;
                        }
                        case 7:
                        {
                            builder.AddLong(j, FuzzTestData.Int64Value, 0);
                            break;
                        }
                        case 8:
                        {
                            builder.AddUlong(j, FuzzTestData.UInt64Value, 0);
                            break;
                        }
                        case 9:
                        {
                            builder.AddFloat(j, FuzzTestData.Float32Value, 0);
                            break;
                        }
                        case 10:
                        {
                            builder.AddDouble(j, FuzzTestData.Float64Value, 0);
                            break;
                        }
                        default:
                            throw new Exception("Unreachable");
                    }

                }

                var offset = builder.EndObject();

                // Store the object offset
                objects[i] = offset;
            }

            _lcg.Reset();

            // Test all objects are readable and return expected values...
            for (var i = 0; i < objectCount; ++i)
            {
                var table = new TestTable(builder.DataBuffer, builder.DataBuffer.Length - objects[i]);

                for (var j = 0; j < fieldCount; ++j)
                {
                    var fieldType = _lcg.Next() % testValuesMax;
                    var fc = 2 + j; // 2 == VtableMetadataFields
                    var f = fc * 2;

                    switch (fieldType)
                    {
                        case 0:
                        {
                            Assert.AreEqual(FuzzTestData.BoolValue, table.GetSlot(f, false));
                            break;
                        }
                        case 1:
                        {
                            Assert.AreEqual(FuzzTestData.Int8Value, table.GetSlot(f, (sbyte)0));
                            break;
                        }
                        case 2:
                        {
                            Assert.AreEqual(FuzzTestData.UInt8Value, table.GetSlot(f, (byte)0));
                            break;
                        }
                        case 3:
                        {
                            Assert.AreEqual(FuzzTestData.Int16Value, table.GetSlot(f, (short)0));
                            break;
                        }
                        case 4:
                        {
                            Assert.AreEqual(FuzzTestData.UInt16Value, table.GetSlot(f, (ushort)0));
                            break;
                        }
                        case 5:
                        {
                            Assert.AreEqual(FuzzTestData.Int32Value, table.GetSlot(f, (int)0));
                            break;
                        }
                        case 6:
                        {
                            Assert.AreEqual(FuzzTestData.UInt32Value, table.GetSlot(f, (uint)0));
                            break;
                        }
                        case 7:
                        {
                            Assert.AreEqual(FuzzTestData.Int64Value, table.GetSlot(f, (long)0));
                            break;
                        }
                        case 8:
                        {
                            Assert.AreEqual(FuzzTestData.UInt64Value, table.GetSlot(f, (ulong)0));
                            break;
                        }
                        case 9:
                        {
                            Assert.AreEqual(FuzzTestData.Float32Value, table.GetSlot(f, (float)0));
                            break;
                        }
                        case 10:
                        {
                            Assert.AreEqual(FuzzTestData.Float64Value, table.GetSlot(f, (double)0));
                            break;
                        }
                        default:
                            throw new Exception("Unreachable");
                    }

                }

            }
        }
Exemplo n.º 6
0
 public static void AddTesthashu64Fnv1(FlatBufferBuilder builder, ulong testhashu64Fnv1)
 {
     builder.AddUlong(19, testhashu64Fnv1, 0);
 }
Exemplo n.º 7
0
 public static void AddTableID(FlatBufferBuilder builder, ulong TableID)
 {
     builder.AddUlong(0, TableID, 0);
 }
Exemplo n.º 8
0
 public static void AddTimestamp(FlatBufferBuilder builder, ulong timestamp)
 {
     builder.AddUlong(1, timestamp, 0);
 }
Exemplo n.º 9
0
 public static void AddULong(FlatBufferBuilder builder, ulong ULong)
 {
     builder.AddUlong(7, ULong, 0);
 }
Exemplo n.º 10
0
 public static void AddMaybeU64(FlatBufferBuilder builder, ulong?maybeU64)
 {
     builder.AddUlong(22, maybeU64);
 }
Exemplo n.º 11
0
 public static void AddNonOwningReference(FlatBufferBuilder builder, ulong nonOwningReference)
 {
     builder.AddUlong(41, nonOwningReference, 0);
 }
Exemplo n.º 12
0
 public static void AddCoOwningReference(FlatBufferBuilder builder, ulong coOwningReference)
 {
     builder.AddUlong(39, coOwningReference, 0);
 }
Exemplo n.º 13
0
 public static void AddSingleWeakReference(FlatBufferBuilder builder, ulong singleWeakReference)
 {
     builder.AddUlong(36, singleWeakReference, 0);
 }
Exemplo n.º 14
0
 public static void AddId(FlatBufferBuilder builder, ulong id)
 {
     builder.AddUlong(0, id, 0);
 }
Exemplo n.º 15
0
 public static void AddHash(FlatBufferBuilder builder, ulong Hash)
 {
     builder.AddUlong(0, Hash, 0);
 }
 internal static void AddDelta(FlatBufferBuilder builder, ulong delta)
 {
     builder.AddUlong(14, delta, 0);
 }
Exemplo n.º 17
0
 public static void AddFrameId(FlatBufferBuilder builder, ulong frameId)
 {
     builder.AddUlong(1, frameId, 0);
 }
Exemplo n.º 18
0
 public static void AddFeaturesCount(FlatBufferBuilder builder, ulong featuresCount)
 {
     builder.AddUlong(5, featuresCount, 0);
 }
Exemplo n.º 19
0
 public static void AddJustU64(FlatBufferBuilder builder, ulong justU64)
 {
     builder.AddUlong(21, justU64, 0);
 }
Exemplo n.º 20
0
 public static void AddKey(FlatBufferBuilder builder, ulong key)
 {
     builder.AddUlong(0, key, 0);
 }
Exemplo n.º 21
0
 public static void AddDefaultU64(FlatBufferBuilder builder, ulong defaultU64)
 {
     builder.AddUlong(23, defaultU64, 42);
 }
 public static void AddDropTableID(FlatBufferBuilder builder, ulong DropTableID)
 {
     builder.AddUlong(13, DropTableID, 0);
 }
Exemplo n.º 23
0
 public static void AddValue(FlatBufferBuilder builder, ulong value)
 {
     builder.AddUlong(1, value, 9223372036854775807);
 }
Exemplo n.º 24
0
 public static void AddTimestampBegin(FlatBufferBuilder builder, ulong timestampBegin)
 {
     builder.AddUlong(0, timestampBegin, 0);
 }
Exemplo n.º 25
0
        private void CheckObjects(int fieldCount, int objectCount)
        {
            _lcg.Reset();

            const int testValuesMax = 11;

            var builder = new FlatBufferBuilder(1);

            var objects = new int[objectCount];

            for (var i = 0; i < objectCount; ++i)
            {
                builder.StartObject(fieldCount);

                for (var j = 0; j < fieldCount; ++j)
                {
                    var fieldType = _lcg.Next() % testValuesMax;

                    switch (fieldType)
                    {
                    case 0:
                    {
                        builder.AddBool(j, FuzzTestData.BoolValue, false);
                        break;
                    }

                    case 1:
                    {
                        builder.AddSbyte(j, FuzzTestData.Int8Value, 0);
                        break;
                    }

                    case 2:
                    {
                        builder.AddByte(j, FuzzTestData.UInt8Value, 0);
                        break;
                    }

                    case 3:
                    {
                        builder.AddShort(j, FuzzTestData.Int16Value, 0);
                        break;
                    }

                    case 4:
                    {
                        builder.AddUshort(j, FuzzTestData.UInt16Value, 0);
                        break;
                    }

                    case 5:
                    {
                        builder.AddInt(j, FuzzTestData.Int32Value, 0);
                        break;
                    }

                    case 6:
                    {
                        builder.AddUint(j, FuzzTestData.UInt32Value, 0);
                        break;
                    }

                    case 7:
                    {
                        builder.AddLong(j, FuzzTestData.Int64Value, 0);
                        break;
                    }

                    case 8:
                    {
                        builder.AddUlong(j, FuzzTestData.UInt64Value, 0);
                        break;
                    }

                    case 9:
                    {
                        builder.AddFloat(j, FuzzTestData.Float32Value, 0);
                        break;
                    }

                    case 10:
                    {
                        builder.AddDouble(j, FuzzTestData.Float64Value, 0);
                        break;
                    }

                    default:
                        throw new Exception("Unreachable");
                    }
                }

                var offset = builder.EndObject();

                // Store the object offset
                objects[i] = offset;
            }

            _lcg.Reset();

            // Test all objects are readable and return expected values...
            for (var i = 0; i < objectCount; ++i)
            {
                var table = new TestTable(builder.DataBuffer, builder.DataBuffer.Length - objects[i]);

                for (var j = 0; j < fieldCount; ++j)
                {
                    var fieldType = _lcg.Next() % testValuesMax;
                    var fc        = 2 + j; // 2 == VtableMetadataFields
                    var f         = fc * 2;

                    switch (fieldType)
                    {
                    case 0:
                    {
                        Assert.AreEqual(FuzzTestData.BoolValue, table.GetSlot(f, false));
                        break;
                    }

                    case 1:
                    {
                        Assert.AreEqual(FuzzTestData.Int8Value, table.GetSlot(f, (sbyte)0));
                        break;
                    }

                    case 2:
                    {
                        Assert.AreEqual(FuzzTestData.UInt8Value, table.GetSlot(f, (byte)0));
                        break;
                    }

                    case 3:
                    {
                        Assert.AreEqual(FuzzTestData.Int16Value, table.GetSlot(f, (short)0));
                        break;
                    }

                    case 4:
                    {
                        Assert.AreEqual(FuzzTestData.UInt16Value, table.GetSlot(f, (ushort)0));
                        break;
                    }

                    case 5:
                    {
                        Assert.AreEqual(FuzzTestData.Int32Value, table.GetSlot(f, (int)0));
                        break;
                    }

                    case 6:
                    {
                        Assert.AreEqual(FuzzTestData.UInt32Value, table.GetSlot(f, (uint)0));
                        break;
                    }

                    case 7:
                    {
                        Assert.AreEqual(FuzzTestData.Int64Value, table.GetSlot(f, (long)0));
                        break;
                    }

                    case 8:
                    {
                        Assert.AreEqual(FuzzTestData.UInt64Value, table.GetSlot(f, (ulong)0));
                        break;
                    }

                    case 9:
                    {
                        Assert.AreEqual(FuzzTestData.Float32Value, table.GetSlot(f, (float)0));
                        break;
                    }

                    case 10:
                    {
                        Assert.AreEqual(FuzzTestData.Float64Value, table.GetSlot(f, (double)0));
                        break;
                    }

                    default:
                        throw new Exception("Unreachable");
                    }
                }
            }
        }
Exemplo n.º 26
0
 internal static void AddFee(FlatBufferBuilder builder, ulong fee)
 {
     builder.AddUlong(6, fee, 0);
 }
 public static void AddBonusTableID(FlatBufferBuilder builder, ulong BonusTableID)
 {
     builder.AddUlong(14, BonusTableID, 0);
 }
Exemplo n.º 28
0
 internal static void AddFeeQuantity(FlatBufferBuilder builder, ulong feeQuantity)
 {
     builder.AddUlong(23, feeQuantity, 0);
 }
Exemplo n.º 29
0
 public static void AddSequence(FlatBufferBuilder builder, ulong sequence)
 {
     builder.AddUlong(0, sequence, 0);
 }
Exemplo n.º 30
0
 public static void AddUlongId(FlatBufferBuilder builder, ulong ulongId)
 {
     builder.AddUlong(1, ulongId, 18446744073709551615);
 }
Exemplo n.º 31
0
 public static void AddTesthashu64Fnv1a(FlatBufferBuilder builder, ulong testhashu64Fnv1a)
 {
     builder.AddUlong(23, testhashu64Fnv1a, 0);
 }
Exemplo n.º 32
0
 public static void AddTickId(FlatBufferBuilder builder, ulong tickId)
 {
     builder.AddUlong(0, tickId, 0);
 }