From 10265aa56b22ac4f04e7ba08330138e4507534e4 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 15 Jul 2011 12:05:43 -0700 Subject: Directory restructure. Includes are now via upb/foo.h. Files specific to the protobuf format are now in upb/pb (the core library is concerned with message definitions, handlers, and byte streams, but knows nothing about any particular serializationf format). --- tests/test_decoder.c | 18 ++++++++---------- tests/test_def.c | 2 +- tests/test_table.cc | 11 ++++++----- tests/test_varint.c | 2 +- tests/test_vs_proto2.cc | 6 +++--- tests/tests.c | 8 ++++---- 6 files changed, 23 insertions(+), 24 deletions(-) (limited to 'tests') diff --git a/tests/test_decoder.c b/tests/test_decoder.c index 1c3bed0..88b8741 100644 --- a/tests/test_decoder.c +++ b/tests/test_decoder.c @@ -1,9 +1,9 @@ #include -#include "upb_decoder.h" -#include "upb_textprinter.h" -#include "upb_stdio.h" -#include "upb_glue.h" +#include "upb/bytestream.h" +#include "upb/pb/decoder.h" +#include "upb/pb/glue.h" +#include "upb/pb/textprinter.h" int main(int argc, char *argv[]) { if (argc < 3) { @@ -23,14 +23,12 @@ int main(int argc, char *argv[]) { upb_read_descriptor(symtab, desc, desc_len, &status); if (!upb_ok(&status)) { fprintf(stderr, "Error parsing descriptor: "); - upb_printerr(&status); + upb_status_print(&status, stderr); return 1; } free((void*)desc); - upb_string *name = upb_strdupc(argv[2]); - upb_def *md = upb_symtab_lookup(symtab, name); - upb_string_unref(name); + upb_def *md = upb_symtab_lookup(symtab, argv[2]); if (!md) { fprintf(stderr, "Descriptor did not contain message: %s\n", argv[2]); return 1; @@ -57,12 +55,12 @@ int main(int argc, char *argv[]) { upb_decoder_initforhandlers(&d, handlers); upb_decoder_reset(&d, upb_stdio_bytesrc(&in), 0, UINT64_MAX, p); - upb_clearerr(&status); + upb_status_clear(&status); upb_decoder_decode(&d, &status); if (!upb_ok(&status)) { fprintf(stderr, "Error parsing input: "); - upb_printerr(&status); + upb_status_print(&status, stderr); } upb_status_uninit(&status); diff --git a/tests/test_def.c b/tests/test_def.c index 248d14a..1f014f6 100644 --- a/tests/test_def.c +++ b/tests/test_def.c @@ -1,6 +1,6 @@ #undef NDEBUG /* ensure tests always assert. */ -#include "upb_def.h" +#include "upb/def.h" #include int main() { diff --git a/tests/test_table.cc b/tests/test_table.cc index 0b47874..8d98f2c 100644 --- a/tests/test_table.cc +++ b/tests/test_table.cc @@ -1,15 +1,16 @@ #undef NDEBUG /* ensure tests always assert. */ -#include "upb_table.h" +#include "upb/table.h" #include "test_util.h" #include +#include +#include +#include +#include #include +#include #include #include -#include -#include -#include -#include bool benchmark = false; #define CPU_TIME_PER_TEST 0.5 diff --git a/tests/test_varint.c b/tests/test_varint.c index 9790295..7dce6ab 100644 --- a/tests/test_varint.c +++ b/tests/test_varint.c @@ -4,7 +4,7 @@ * Copyright (c) 2011 Google Inc. See LICENSE for details. */ -#include "upb_varint.h" +#include "upb/pb/varint.h" #include "upb_test.h" static void test_varint_decoder(upb_decoderet (*decoder)(const char*)) { diff --git a/tests/test_vs_proto2.cc b/tests/test_vs_proto2.cc index d220ff3..0444d40 100644 --- a/tests/test_vs_proto2.cc +++ b/tests/test_vs_proto2.cc @@ -11,10 +11,10 @@ #include #include #include +#include "upb/def.h" +#include "upb/msg.h" +#include "upb/pb/glue.h" #include "upb_test.h" -#include "upb_def.h" -#include "upb_glue.h" -#include "upb_msg.h" #include MESSAGE_HFILE diff --git a/tests/tests.c b/tests/tests.c index aa692f6..5cbbd78 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -2,11 +2,11 @@ #include #include #include -#include "upb_def.h" -#include "upb_glue.h" +#include "upb/def.h" +#include "upb/handlers.h" +#include "upb/pb/decoder.h" +#include "upb/pb/glue.h" #include "upb_test.h" -#include "upb_handlers.h" -#include "upb_decoder.h" static upb_symtab *load_test_proto() { upb_symtab *s = upb_symtab_new(); -- cgit v1.2.3