예제 #1
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);
        }
예제 #2
0
 public static void AddTesthashs64Fnv1(FlatBufferBuilder builder, long testhashs64Fnv1)
 {
     builder.AddLong(18, testhashs64Fnv1, 0);
 }
예제 #3
0
 public static void AddLong(FlatBufferBuilder builder, long Long)
 {
     builder.AddLong(8, Long, 0);
 }
예제 #4
0
 public static void AddPostt(FlatBufferBuilder builder, long postt)
 {
     builder.AddLong(34, postt, 0);
 }
 public static void AddVal(FlatBufferBuilder builder, long val)
 {
     builder.AddLong(1, val, 0);
 }
예제 #6
0
 public static void AddStartTime(FlatBufferBuilder builder, long startTime)
 {
     builder.AddLong(1, startTime, 0);
 }
예제 #7
0
 public static void AddLongValue(FlatBufferBuilder builder, long longValue)
 {
     builder.AddLong(8, longValue, 0);
 }
예제 #8
0
 public static void AddTimestamp(FlatBufferBuilder builder, long timestamp)
 {
     builder.AddLong(3, timestamp, 0);
 }
예제 #9
0
 public static void AddThird(FlatBufferBuilder builder, long third)
 {
     builder.AddLong(2, third, 0);
 }
예제 #10
0
 public static void AddSecond(FlatBufferBuilder builder, long second)
 {
     builder.AddLong(1, second, 0);
 }
예제 #11
0
 public static void AddFirst(FlatBufferBuilder builder, long first)
 {
     builder.AddLong(0, first, 0);
 }
예제 #12
0
 public static void AddOt(FlatBufferBuilder builder, long ot)
 {
     builder.AddLong(2, ot, 0);
 }
예제 #13
0
 public static void AddOpponentUserId(FlatBufferBuilder builder, long opponentUserId)
 {
     builder.AddLong(3, opponentUserId, 0);
 }
예제 #14
0
 public static void AddBodyLength(FlatBufferBuilder builder, long bodyLength)
 {
     builder.AddLong(3, bodyLength, 0);
 }
예제 #15
0
 public static void AddI64(FlatBufferBuilder builder, long i64)
 {
     builder.AddLong(6, i64, 0);
 }
예제 #16
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");
                    }

                }

            }
        }
예제 #17
0
 public static void AddOpNum(FlatBufferBuilder builder, long opNum)
 {
     builder.AddLong(3, opNum, 0);
 }
예제 #18
0
 public static void AddFootprintBackward(FlatBufferBuilder builder, long footprintBackward)
 {
     builder.AddLong(4, footprintBackward, 0);
 }
예제 #19
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");
                    }
                }
            }
        }
예제 #20
0
 public static void AddId(FlatBufferBuilder builder, long id)
 {
     builder.AddLong(0, id, 0);
 }
예제 #21
0
 public static void AddLength(FlatBufferBuilder builder, long length)
 {
     builder.AddLong(0, length, 0);
 }
예제 #22
0
 public static void AddNumber(FlatBufferBuilder builder, long number)
 {
     builder.AddLong(1, number, 0);
 }
예제 #23
0
 public static void AddEndTime(FlatBufferBuilder builder, long endTime)
 {
     builder.AddLong(2, endTime, 0);
 }
예제 #24
0
파일: Node.cs 프로젝트: Veivan/MorphApp
 public static void AddNodeID(FlatBufferBuilder builder, long NodeID)
 {
     builder.AddLong(5, NodeID, 0);
 }
예제 #25
0
 public static void AddPvpScore(FlatBufferBuilder builder, long pvpScore)
 {
     builder.AddLong(14, pvpScore, 0);
 }
예제 #26
0
 public static void AddNotifyTimeStamp(FlatBufferBuilder builder, long notifyTimeStamp)
 {
     builder.AddLong(6, notifyTimeStamp, 0);
 }
예제 #27
0
 public static void AddCode(FlatBufferBuilder builder, long code)
 {
     builder.AddLong(2, code, 0);
 }
예제 #28
0
 public static void AddHp(FlatBufferBuilder builder, long hp)
 {
     builder.AddLong(8, hp, 0);
 }
 internal static void AddRentalFee(FlatBufferBuilder builder, long rentalFee)
 {
     builder.AddLong(10, rentalFee, 0);
 }
예제 #30
0
 public static void AddComtype(FlatBufferBuilder builder, ComType comtype)
 {
     builder.AddLong(2, (long)comtype, 0);
 }
예제 #31
0
 public static void AddTesthashs64Fnv1a(FlatBufferBuilder builder, long testhashs64Fnv1a)
 {
     builder.AddLong(22, testhashs64Fnv1a, 0);
 }
예제 #32
0
 public static void AddDbID(FlatBufferBuilder builder, long dbID)
 {
     builder.AddLong(8, dbID, 0);
 }