summaryrefslogtreecommitdiff
path: root/tests/test_cpp.cc
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2011-11-19 10:22:26 -0800
committerJoshua Haberman <jhaberman@gmail.com>2011-11-19 10:22:26 -0800
commit99ae0ed39723b9c8f97fbdde070681e2a8b7a20e (patch)
tree1d190d4c83547f5847ad9d26e4d74d444bc3bd5e /tests/test_cpp.cc
parentd29339d126c50818b7f21d2581caadfeea946934 (diff)
Changes to get upb compiling inside Google.
Diffstat (limited to 'tests/test_cpp.cc')
-rw-r--r--tests/test_cpp.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/test_cpp.cc b/tests/test_cpp.cc
index 35526fb..11542bf 100644
--- a/tests/test_cpp.cc
+++ b/tests/test_cpp.cc
@@ -1,12 +1,20 @@
+/*
+ * upb - a minimalist implementation of protocol buffers.
+ *
+ * Copyright (c) 2011 Google Inc. See LICENSE for details.
+ * Author: Josh Haberman <jhaberman@gmail.com>
+ *
+ * Tests for C++ wrappers.
+ */
#include <iostream>
#include "upb/def.hpp"
#include "upb/pb/glue.hpp"
-static void TestSymbolTable() {
+static void TestSymbolTable(const char *descriptor_file) {
upb::SymbolTable *s = upb::SymbolTable::New();
upb::Status status;
- if (!upb::LoadDescriptorFileIntoSymtab(s, "tests/test.proto.pb", &status)) {
+ if (!upb::LoadDescriptorFileIntoSymtab(s, descriptor_file, &status)) {
std::cerr << "Couldn't load descriptor: " << status;
exit(1);
}
@@ -17,6 +25,11 @@ static void TestSymbolTable() {
md->Unref();
}
-int main() {
- TestSymbolTable();
+int main(int argc, char *argv[]) {
+ if (argc < 2) {
+ fprintf(stderr, "Usage: test_cpp <descriptor file>\n");
+ return 1;
+ }
+ TestSymbolTable(argv[1]);
+ return 0;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback