summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2010-01-01 17:31:14 -0800
committerJoshua Haberman <joshua@reverberate.org>2010-01-01 17:31:14 -0800
commitece08710a64e09baf4bdcb71752ce20ff1d4a757 (patch)
tree4aec32670cccdf6dfeacf385eedca10f8f1292ed /tests
parent2fdc9df97eab06f2b42c1a9a87bc01d5e9feedd7 (diff)
Bugfixes: descriptorgen works without leaks!
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/tests.c b/tests/tests.c
index 5704292..9479e82 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -16,8 +16,8 @@ static void test_get_v_uint64_t()
{
#define TEST(name, bytes, val) {\
struct upb_status status = UPB_STATUS_INIT; \
- uint8_t name[] = bytes; \
- uint8_t *name ## _buf = name; \
+ const uint8_t name[] = bytes; \
+ const uint8_t *name ## _buf = name; \
uint64_t name ## _val = 0; \
name ## _buf = upb_get_v_uint64_t(name, name + sizeof(name) - 1, &name ## _val, &status); \
ASSERT(upb_ok(&status)); \
@@ -80,8 +80,8 @@ static void test_get_v_uint32_t()
{
#define TEST(name, bytes, val) {\
struct upb_status status = UPB_STATUS_INIT; \
- uint8_t name[] = bytes; \
- uint8_t *name ## _buf = name; \
+ const uint8_t name[] = bytes; \
+ const uint8_t *name ## _buf = name; \
uint32_t name ## _val = 0; \
name ## _buf = upb_get_v_uint32_t(name, name + sizeof(name), &name ## _val, &status); \
ASSERT(upb_ok(&status)); \
@@ -145,8 +145,8 @@ static void test_skip_v_uint64_t()
{
#define TEST(name, bytes) {\
struct upb_status status = UPB_STATUS_INIT; \
- uint8_t name[] = bytes; \
- uint8_t *name ## _buf = name; \
+ const uint8_t name[] = bytes; \
+ const uint8_t *name ## _buf = name; \
name ## _buf = upb_skip_v_uint64_t(name ## _buf, name + sizeof(name), &status); \
ASSERT(upb_ok(&status)); \
ASSERT(name ## _buf == name + sizeof(name) - 1); /* - 1 for NULL */ \
@@ -206,8 +206,8 @@ static void test_get_f_uint32_t()
{
#define TEST(name, bytes, val) {\
struct upb_status status = UPB_STATUS_INIT; \
- uint8_t name[] = bytes; \
- uint8_t *name ## _buf = name; \
+ const uint8_t name[] = bytes; \
+ const uint8_t *name ## _buf = name; \
uint32_t name ## _val = 0; \
name ## _buf = upb_get_f_uint32_t(name ## _buf, name + sizeof(name), &name ## _val, &status); \
ASSERT(upb_ok(&status)); \
@@ -230,7 +230,7 @@ static void test_get_f_uint32_t()
static void test_upb_symtab() {
struct upb_symtab *s = upb_symtab_new();
ASSERT(s);
- struct upb_string *descriptor = upb_strreadfile("tests/test.proto.pb");
+ upb_string *descriptor = upb_strreadfile("tests/test.proto.pb");
if(!descriptor) {
fprintf(stderr, "Couldn't read input file tests/test.proto.pb\n");
exit(1);
@@ -242,7 +242,7 @@ static void test_upb_symtab() {
// Test cycle detection by making a cyclic def's main refcount go to zero
// and then be incremented to one again.
- struct upb_string *symname = upb_strdupc("A");
+ upb_string *symname = upb_strdupc("A");
struct upb_def *def = upb_symtab_lookup(s, symname);
upb_string_unref(symname);
ASSERT(def);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback