From b6a92a93c619e012b2f57640495cc48809e89860 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 2 Sep 2018 13:58:42 -0700 Subject: More work on CMake build, and updated conformance for proto3. --- tests/conformance_upb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/conformance_upb.c b/tests/conformance_upb.c index 5c0ce88..ea5365c 100644 --- a/tests/conformance_upb.c +++ b/tests/conformance_upb.c @@ -39,6 +39,10 @@ void CheckedWrite(int fd, const void *buf, size_t len) { } } +bool stringview_eql(upb_stringview view, const char *str) { + return view.size == strlen(str) && memcmp(view.data, str, view.size) == 0; +} + static const char *proto3_msg = "protobuf_test_messages.proto3.TestAllTypesProto3"; @@ -48,7 +52,7 @@ void DoTest( upb_env *env) { upb_stringview message_type = conformance_ConformanceRequest_message_type(request); - if (strcmp(message_type.data, proto3_msg) != 0) { + if (!stringview_eql(message_type, proto3_msg)) { static const char msg[] = "Only proto3 for now."; conformance_ConformanceResponse_set_skipped( response, upb_stringview_make(msg, sizeof(msg))); -- cgit v1.2.3