26 EXPECT_EQ(
tpa_size(_tpa), 4096) <<
"Size of TPA with no entries correct";
27 EXPECT_EQ(
tpa_entries(_tpa), 0) <<
"Entrycount of TPA with no entries correct";
28 EXPECT_EQ(
tpa_length(_tpa), -1) <<
"Length of TPA with no entries correct";
37 SCOPED_TRACE(
"Checking sizes with a single entry");
42 EXPECT_EQ(
tpa_size(_tpa), 8192) <<
"Size of TPA with a single entry correct";
43 EXPECT_EQ(
tpa_entries(_tpa), 1) <<
"Entrycount of TPA with a single entry correct";
44 EXPECT_EQ(
tpa_length(_tpa), len) <<
"Length of TPA with no entries correct";
48 SCOPED_TRACE(
"Checking retrieval of known-good value");
52 EXPECT_NE(
entry, (
void*)0) <<
"Entry returned";
57 SCOPED_TRACE(
"Checking retrieval of known-bad value");
59 void* non_entry =
tpa_get(_tpa, idx + 1);
60 EXPECT_EQ(non_entry, (
void*)0) <<
"Not existing entry returns 0";
64 SCOPED_TRACE(
"Checking size after deleting all data");
68 EXPECT_EQ(
tpa_size(_tpa), _tpa_page_size) <<
"Size of TPA with all entries deleted";
69 EXPECT_EQ(
tpa_entries(_tpa), 0) <<
"Entrycount of TPA with all entries deleted";
70 EXPECT_EQ(
tpa_length(_tpa), -1) <<
"Length of TPA with all entries deleted";
77 const size_t entry_count = (rand() / (double)RAND_MAX) * 256 * 1024;
78 RecordProperty(
"EntryCount", entry_count);
82 const size_t expected_tpa_size = _tpa_page_size
86 for(
size_t i = 0; i < entry_count; ++i) {
90 EXPECT_EQ(
tpa_size(_tpa), expected_tpa_size) <<
"Size of TPA with lots of entries";
91 EXPECT_EQ(
tpa_entries(_tpa), entry_count) <<
"Entrycount of TPA with lots of entries";
92 EXPECT_EQ(
tpa_length(_tpa), expected_tpa_len) <<
"Length of TPA with lots of entries";
const size_t _tpa_page_size
size_t num_pages
Number of pages, where page size is 4096 bytes.
TEST_F(MessageQueueTest, PopFromEmptyQueue)
tpa_t * tpa_new(allocator_t *alloc, uint64_t entry_size, uint64_t page_size, tpa_t *tpa)
void tpa_delete(tpa_t *tpa)
size_t tpa_size(tpa_t *tpa)
void * tpa_get(tpa_t *tpa, uint64_t idx)
ssize_t tpa_length(tpa_t *tpa)
void tpa_set(tpa_t *tpa, uint64_t idx, void *data)
size_t tpa_entries(tpa_t *tpa)
size_t tpa_entries_per_page(tpa_t *tpa)