Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@chromium.org>2015-01-28 23:33:54 +0300
committerAdam Langley <agl@google.com>2015-01-28 23:38:24 +0300
commitf058dae8fcea8866aa3a67988000a03775642b30 (patch)
tree7b65d87cafa045d27e62f8ed4ceabeff9936360a /crypto/conf
parentdc94b54708177172c8afca5cea406d992f3c7e51 (diff)
Revert "Add a test for CONF_parse_list."
This reverts commit cd5c892a871389dfa077bda6eec64ffa62dac722. We'd rather get rid of crypto/conf altogether, and these tests will require that we OPENSSL_EXPORT conf.h's functions. Change-Id: I271511ba321201e60de94e5c79c4b565ce31728f Reviewed-on: https://boringssl-review.googlesource.com/3120 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/conf')
-rw-r--r--crypto/conf/CMakeLists.txt8
-rw-r--r--crypto/conf/conf_test.c129
2 files changed, 0 insertions, 137 deletions
diff --git a/crypto/conf/CMakeLists.txt b/crypto/conf/CMakeLists.txt
index 3d842cb7..05439d54 100644
--- a/crypto/conf/CMakeLists.txt
+++ b/crypto/conf/CMakeLists.txt
@@ -8,11 +8,3 @@ add_library(
conf.c
conf_error.c
)
-
-add_executable(
- conf_test
-
- conf_test.c
-)
-
-target_link_libraries(conf_test crypto)
diff --git a/crypto/conf/conf_test.c b/crypto/conf/conf_test.c
deleted file mode 100644
index 57e95f17..00000000
--- a/crypto/conf/conf_test.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Copyright (c) 2014, Google Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
-
-#include <stdio.h>
-#include <string.h>
-
-#include <openssl/conf.h>
-#include <openssl/crypto.h>
-
-
-static int stop_cb(const char *elem, int len, void *data) {
- int *count = (int *)data;
- (*count)++;
- return -42;
-}
-
-static int test_stop_iteration(void) {
- int count = 0;
- if (CONF_parse_list("foo|bar", '|', 0, stop_cb, &count) != -42) {
- fprintf(stderr, "CONF_parse_list returned incorrect value.\n");
- return 0;
- }
-
- if (count != 1) {
- fprintf(stderr, "stop_cb called incorrect number of times.\n");
- return 0;
- }
-
- return 1;
-}
-
-static int test_cb(const char *elem, int len, void *data) {
- const char ***ptr = data;
- const char **next = *ptr;
- if (*next == NULL) {
- /* The callback hit the trailing NULL early. */
- fprintf(stderr, "test_cb called too many times.\n");
- return 0;
- }
- if (len < 0 || (size_t)len != strlen(*next) ||
- strncmp(elem, *next, len) != 0) {
- fprintf(stderr, "test_cb called on '%.*s', wanted '%s'\n", len, elem, *next);
- return 0;
- }
- /* Advance to the next expectation. */
- *ptr = next + 1;
- return 1;
-}
-
-static int test_parse_list(const char *list, int remove_whitespace,
- const char **expected) {
- const char **next = expected;
- if (!CONF_parse_list(list, ',', remove_whitespace, test_cb, &next)) {
- return 0;
- }
- if (*next != NULL) {
- fprintf(stderr, "test_cb called too few times.\n");
- return 0;
- }
- return 1;
-}
-
-/* Test basic parsing. Whitespace is not trimmed, empty entries are
- * preserved. */
-static const char kList1[] = " foo ,, bar , baz ";
-static const int kRemoveWhitespace1 = 0;
-static const char *kExpected1[] = {
- " foo ",
- "",
- " bar ",
- " baz ",
- NULL,
-};
-
-/* Test that a trailing separator gives an empty entry. */
-static const char kList2[] = "foo,bar,baz,";
-static const int kRemoveWhitespace2 = 0;
-static const char *kExpected2[] = {
- "foo",
- "bar",
- "baz",
- "",
- NULL,
-};
-
-/* Test whitespace removal. */
-static const char kList3[] = " foo ,\n,bar\t, baz ";
-static const int kRemoveWhitespace3 = 1;
-static const char *kExpected3[] = {
- "foo",
- "",
- "bar",
- "baz",
- NULL,
-};
-
-/* Test empty string behavior. */
-static const char kList4[] = "";
-static const int kRemoveWhitespace4 = 0;
-static const char *kExpected4[] = {
- "",
- NULL,
-};
-
-int main(void) {
- CRYPTO_library_init();
-
- if (!test_stop_iteration() ||
- !test_parse_list(kList1, kRemoveWhitespace1, kExpected1) ||
- !test_parse_list(kList2, kRemoveWhitespace2, kExpected2) ||
- !test_parse_list(kList3, kRemoveWhitespace3, kExpected3) ||
- !test_parse_list(kList4, kRemoveWhitespace4, kExpected4)) {
- return 1;
- }
-
- printf("PASS\n");
- return 0;
-}