summaryrefslogtreecommitdiff
path: root/tests/test_table.cc
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2010-07-10 12:15:31 -0700
committerJoshua Haberman <joshua@reverberate.org>2010-07-10 12:15:31 -0700
commite29bf964d1716398e8354a50f506906a307298e5 (patch)
treee428e4a42590db311b3e3b6816bbf1341e979cbc /tests/test_table.cc
parent28ec9a1fa0f9b1d741920dfa8afc91fa2532c43d (diff)
Tests for string and fleshed out implementation.
Diffstat (limited to 'tests/test_table.cc')
-rw-r--r--tests/test_table.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/test_table.cc b/tests/test_table.cc
index 37e14a8..47d5e57 100644
--- a/tests/test_table.cc
+++ b/tests/test_table.cc
@@ -12,6 +12,8 @@
#include <sys/resource.h>
#include <iostream>
+bool benchmark = false;
+
using std::string;
using std::vector;
@@ -116,6 +118,11 @@ void test_inttable(int32_t *keys, size_t num_entries)
}
}
+ if(!benchmark) {
+ upb_inttable_free(&table);
+ return;
+ }
+
/* Test performance. We only test lookups for keys that are known to exist. */
uintptr_t x = 0;
const unsigned int iterations = 0xFFFFFF;
@@ -219,8 +226,12 @@ int32_t *get_contiguous_keys(int32_t num)
return buf;
}
-int main()
+int main(int argc, char *argv[])
{
+ for (int i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "--benchmark") == 0) benchmark = true;
+ }
+
vector<string> keys;
keys.push_back("google.protobuf.FileDescriptorSet");
keys.push_back("google.protobuf.FileDescriptorProto");
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback