MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/lite/simple_memory_arena_test.cc:24–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22namespace {
23
24TEST(SimpleMemoryArenaTest, BasicArenaOperations) {
25 TfLiteContext context;
26 SimpleMemoryArena arena(64);
27 ArenaAlloc allocs[6];
28
29 arena.Allocate(&context, 32, 2047, &allocs[0]);
30 arena.Allocate(&context, 32, 2047, &allocs[1]);
31 arena.Allocate(&context, 32, 2047, &allocs[2]);
32 arena.Deallocate(&context, allocs[0]);
33 arena.Allocate(&context, 32, 1023, &allocs[3]);
34 arena.Allocate(&context, 32, 2047, &allocs[4]);
35 arena.Deallocate(&context, allocs[1]);
36 arena.Allocate(&context, 32, 1023, &allocs[5]);
37
38 EXPECT_EQ(allocs[0].offset, 0);
39 EXPECT_EQ(allocs[1].offset, 2048);
40 EXPECT_EQ(allocs[2].offset, 4096);
41 EXPECT_EQ(allocs[3].offset, 0);
42 EXPECT_EQ(allocs[4].offset, 6144);
43 EXPECT_EQ(allocs[5].offset, 1024);
44}
45
46TEST(SimpleMemoryArenaTest, BasicZeroAlloc) {
47 TfLiteContext context;

Callers

nothing calls this directly

Calls 5

ResolveAllocMethod · 0.80
AllocateMethod · 0.45
DeallocateMethod · 0.45
CommitMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected