Lines Matching full:local
2 local compat = require("flatbuffers.compat")
4 local performBenchmarkTests = false
15 local function checkReadBuffer(buf, offset, sizePrefix)
23 local size = flatbuffers.N.Int32:Unpack(buf, offset)
28 local mon = monster.GetRootAsMonster(buf, offset)
34 local vec = assert(mon:Pos(), "Monster Position is nil")
41 local t = require("MyGame.Example.Test").New()
47 local ut = require("MyGame.Example.Any")
50 local table2 = mon:Test()
53 local mon2 = monster.New()
59 local invsum = 0
61 local v = mon:Inventory(i)
70 local dbls = { -1.7976931348623157e+308, 0, 1.7976931348623157e+308}
77 local test0 = mon:Test4(1)
78 local test1 = mon:Test4(2)
80 local v0 = test0:A()
81 local v1 = test0:B()
82 local v2 = test1:A()
83 local v3 = test1:B()
85 local sumtest12 = v0 + v1 + v2 + v3
97 local function generateMonster(sizePrefix, b)
100 local str = b:CreateString("MyMonster")
101 local test1 = b:CreateString("test1")
102 local test2 = b:CreateString("test2")
103 local fred = b:CreateString("Fred")
111 local inv = b:EndVector(5)
115 local mon2 = monster.End(b)
120 local test4 = b:EndVector(2)
125 local testArrayOfString = b:EndVector(2)
133 local vectorOfLongs = b:EndVector(5)
139 local vectorOfDoubles = b:EndVector(3)
142 local pos = vec3.CreateVec3(b, 1.0, 2.0, 3.0, 3.0, 2, 5, 6)
158 local mon = monster.End(b)
168 local function sizePrefix(sizePrefix)
169 local buf,offset = generateMonster(sizePrefix)
173 local function fbbClear()
175 local fbb = flatbuffers.Builder(0)
178 local buf, offset = generateMonster(false, fbb)
185 local monsters = {}
186 local lastBuf
191 local strOffset = builder:CreateString("Hi there")
197 local buf = builder:Output(false)
218 local function testCanonicalData()
219 local f = assert(io.open('monsterdata_test.mon', 'rb'))
220 local wireData = f:read("*a")
225 local function testCreateEmptyString()
226 local b = flatbuffers.Builder(0)
227 local str = b:CreateString("")
231 local s = b:Output()
232 local data = flatbuffers.binaryArray.New(s)
233 local mon = monster.GetRootAsMonster(data, 0)
237 local function benchmarkMakeMonster(count, reuseBuilder)
238 local fbb = reuseBuilder and flatbuffers.Builder(0)
239 local length = #(generateMonster(false, fbb))
241 local s = os.clock()
245 local e = os.clock()
247 local dur = (e - s)
248 local rate = count / (dur * 1000)
249 local data = (length * count) / (1024 * 1024)
250 local dataRate = data / dur
256 local function benchmarkReadBuffer(count)
257 local f = assert(io.open('monsterdata_test.mon', 'rb'))
258 local buf = f:read("*a")
261 local s = os.clock()
265 local e = os.clock()
267 local dur = (e - s)
268 local rate = count / (dur * 1000)
269 local data = (#buf * count) / (1024 * 1024)
270 local dataRate = data / dur
276 local function getRootAs_canAcceptString()
277 local f = assert(io.open('monsterdata_test.mon', 'rb'))
278 local wireData = f:read("*a")
281 local mon = monster.GetRootAsMonster(wireData, 0)
285 local function testAccessByteVectorAsString()
286 local f = assert(io.open('monsterdata_test.mon', 'rb'))
287 local wireData = f:read("*a")
289 local mon = monster.GetRootAsMonster(wireData, 0)
291 local s = mon:InventoryAsString(1, 3)
297 local s = mon:InventoryAsString(2, 5)
303 local s = mon:InventoryAsString(5, 5)
307 local s = mon:InventoryAsString(2)
313 local s = mon:InventoryAsString()
320 local tests =
349 local benchmarks =
375 local result, err = xpcall(function()
381 local function buildArgList(tbl)
382 local s = ""
395 local testsPassed, testsFailed = 0,0
397 local allargs = test.args or {{}}
399 local results, err = xpcall(test.f,debug.traceback, table.unpack(args))
412 local totalTests = testsPassed + testsFailed