diff options
author | Emilia Kasper <emilia@openssl.org> | 2016-07-04 20:16:14 +0200 |
---|---|---|
committer | Emilia Kasper <emilia@openssl.org> | 2016-07-19 14:17:48 +0200 |
commit | ce2cdac2787da32bcde210c7d6acdcbe41b1cd40 (patch) | |
tree | aa513a318f435fd51c82df0f83aa09219d55e1cc /test/testutil.c | |
parent | 02f730b34706150f8f40715d647cce3be5baf2ab (diff) |
SSL test framework: port NPN and ALPN tests
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'test/testutil.c')
-rw-r--r-- | test/testutil.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/testutil.c b/test/testutil.c index 9a67630fd3..a16ef0fa07 100644 --- a/test/testutil.c +++ b/test/testutil.c @@ -12,6 +12,7 @@ #include <assert.h> #include <stdlib.h> #include <stdio.h> +#include <string.h> #include "e_os.h" /* @@ -89,3 +90,20 @@ int run_tests(const char *test_prog_name) printf(" All tests passed.\n"); return EXIT_SUCCESS; } + +static const char *print_string_maybe_null(const char *s) +{ + return s == NULL ? "(NULL)" : s; +} + +int strings_equal(const char *desc, const char *s1, const char *s2) +{ + if (s1 == NULL && s2 == NULL) + return 1; + if (s1 == NULL || s2 == NULL || strcmp(s1, s2) != 0) { + fprintf(stderr, "%s mismatch: %s vs %s\n", desc, print_string_maybe_null(s1), + print_string_maybe_null(s2)); + return 0; + } + return 1; +} |