diff options
Diffstat (limited to 'tests/test_cpp.cc')
-rw-r--r-- | tests/test_cpp.cc | 21 |
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; } |