summaryrefslogtreecommitdiff
path: root/tests/test_table.cc
diff options
context:
space:
mode:
authorJosh Haberman <jhaberman@gmail.com>2015-05-17 16:11:07 -0700
committerJosh Haberman <jhaberman@gmail.com>2015-05-17 16:24:08 -0700
commite2840a4aa1b6a7a2ca1421d0d6da3e56992e5090 (patch)
treee0712b93de15663281e0da4fb45800d8d3b83489 /tests/test_table.cc
parent0c7eb664fc134b67dec304077e39eecdaff940f3 (diff)
Restructure tables for C89 port and smaller size.
Changes the data layout of tables slightly so that string keys are prefixed with their size, rather than the size being inline in the table itself. This has a few benefits: 1. inttables shrink a bit, because there is no longer a wasted and unused size field sitting in them. 2. This avoids the need to have a union in the table. This is important for an impending C89 port of upb, since C89 has literally no way of statically initializing a non-first union member.
Diffstat (limited to 'tests/test_table.cc')
-rw-r--r--tests/test_table.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/test_table.cc b/tests/test_table.cc
index 9cc98b1..30c5c94 100644
--- a/tests/test_table.cc
+++ b/tests/test_table.cc
@@ -62,6 +62,8 @@ void test_strtable(const vector<std::string>& keys, uint32_t num_to_insert) {
upb_strtable_next(&iter)) {
const char *key = upb_strtable_iter_key(&iter);
std::string tmp(key, strlen(key));
+ std::string tmp2(key, upb_strtable_iter_keylength(&iter));
+ ASSERT(tmp == tmp2);
std::set<std::string>::iterator i = all.find(tmp);
ASSERT(i != all.end());
all.erase(i);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback