diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2011-12-22 11:37:01 -0800 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2011-12-22 11:37:01 -0800 |
commit | 1bcab1377de6afe8c0f9c895cdba04baacf3e4a5 (patch) | |
tree | 4d478ccff5da0dee3c217c01f815ee1764965501 /tests/test_cpp.cc | |
parent | b5f5ee867e6c91b77490dc8894236f17a47bde00 (diff) |
Sync with internal Google development.
This breaks the open-source build, will
follow up with a change to fix it.
Diffstat (limited to 'tests/test_cpp.cc')
-rw-r--r-- | tests/test_cpp.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_cpp.cc b/tests/test_cpp.cc index ecf27bf..5182217 100644 --- a/tests/test_cpp.cc +++ b/tests/test_cpp.cc @@ -9,7 +9,11 @@ #include <stdio.h> #include <iostream> +#include "upb/bytestream.hpp" #include "upb/def.hpp" +#include "upb/handlers.hpp" +#include "upb/upb.hpp" +#include "upb/pb/decoder.hpp" #include "upb/pb/glue.hpp" static void TestSymbolTable(const char *descriptor_file) { @@ -26,11 +30,22 @@ static void TestSymbolTable(const char *descriptor_file) { md->Unref(); } +static void TestByteStream() { + upb::StringSource stringsrc; + stringsrc.Reset("testing", 7); + upb::ByteRegion* byteregion = stringsrc.AllBytes(); + assert(byteregion->FetchAll() == UPB_BYTE_OK); + char* str = byteregion->StrDup(); + assert(strcmp(str, "testing") == 0); + free(str); +} + int main(int argc, char *argv[]) { if (argc < 2) { fprintf(stderr, "Usage: test_cpp <descriptor file>\n"); return 1; } TestSymbolTable(argv[1]); + TestByteStream(); return 0; } |