MCPcopy Create free account
hub / github.com/dds-bridge/dds / TEST

Function TEST

library/tests/system/tt_sharing_test.cpp:13–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11extern Memory memory;
12
13TEST(TransTableSharingTest, SameThreadSharesTT)
14{
15 if (memory.NumThreads() == 0)
16 memory.Resize(1, DDS_TT_SMALL, THREADMEM_SMALL_DEF_MB, THREADMEM_SMALL_MAX_MB);
17
18 // Create an owning context for this (simulates a thread-local owner)
19 SolverContext owner;
20 auto thr = owner.thread();
21 SolverContext ctx1{thr};
22 SolverContext ctx2{thr};
23
24 // Initially no TT
25 EXPECT_EQ(ctx1.maybe_trans_table(), nullptr);
26 EXPECT_EQ(ctx2.maybe_trans_table(), nullptr);
27
28 TransTable* t1 = ctx1.trans_table();
29 ASSERT_NE(t1, nullptr);
30 TransTable* t2 = ctx2.maybe_trans_table();
31 ASSERT_NE(t2, nullptr);
32 EXPECT_EQ(t1, t2);
33
34 // Dispose via one context should remove from registry
35 ctx1.dispose_trans_table();
36 EXPECT_EQ(ctx2.maybe_trans_table(), nullptr);
37}

Callers

nothing calls this directly

Calls 6

NumThreadsMethod · 0.80
ResizeMethod · 0.80
threadMethod · 0.80
maybe_trans_tableMethod · 0.80
trans_tableMethod · 0.80
dispose_trans_tableMethod · 0.80

Tested by

no test coverage detected