[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Add new source file to test target
commit 55412c4f3d3486d28fe337b919e7fddc2f93e1b4
Author: rl1987 <rl1987@xxxxxxxxxxxxxxxx>
Date: Thu Oct 11 15:22:12 2018 +0300
Add new source file to test target
---
src/test/include.am | 1 +
src/test/test.c | 1 +
src/test/test.h | 1 +
src/test/test_parsecommon.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 47 insertions(+)
diff --git a/src/test/include.am b/src/test/include.am
index 1055cd0a8..dd2986c67 100644
--- a/src/test/include.am
+++ b/src/test/include.am
@@ -182,6 +182,7 @@ src_test_test_SOURCES += \
src/test/test_x509.c \
src/test/test_helpers.c \
src/test/test_dns.c \
+ src/test/test_parsecommon.c \
src/test/testing_common.c \
src/test/testing_rsakeys.c \
src/ext/tinytest.c
diff --git a/src/test/test.c b/src/test/test.c
index 70d91e396..56eb15328 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -926,5 +926,6 @@ struct testgroup_t testgroups[] = {
{ "util/thread/", thread_tests },
{ "util/handle/", handle_tests },
{ "dns/", dns_tests },
+ { "parsecommon/", parsecommon_tests },
END_OF_GROUPS
};
diff --git a/src/test/test.h b/src/test/test.h
index a46fedf3e..281551aa6 100644
--- a/src/test/test.h
+++ b/src/test/test.h
@@ -266,6 +266,7 @@ extern struct testcase_t dns_tests[];
extern struct testcase_t handle_tests[];
extern struct testcase_t sr_tests[];
extern struct testcase_t x509_tests[];
+extern struct testcase_t parsecommon_tests[];
extern struct testcase_t slow_crypto_tests[];
extern struct testcase_t slow_util_tests[];
diff --git a/src/test/test_parsecommon.c b/src/test/test_parsecommon.c
new file mode 100644
index 000000000..f152450f5
--- /dev/null
+++ b/src/test/test_parsecommon.c
@@ -0,0 +1,44 @@
+/* Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#include "core/or/or.h"
+#include "test/test.h"
+#include "lib/memarea/memarea.h"
+#include "lib/encoding/binascii.h"
+#include "feature/dirparse/parsecommon.h"
+#include "test/log_test_helpers.h"
+
+static void
+test_parsecommon_tokenize_string_null(void *arg)
+{
+
+ memarea_t *area = memarea_new();
+ smartlist_t *tokens = smartlist_new();
+
+ (void)arg;
+
+ const char *str_with_null = "a\0bccccccccc";
+
+ int retval =
+ tokenize_string(area, str_with_null,
+ str_with_null + 3,
+ tokens, NULL, 0);
+
+ tt_int_op(retval, OP_EQ, -1);
+
+ done:
+ memarea_drop_all(area);
+ smartlist_free(tokens);
+ return;
+}
+
+#define PARSECOMMON_TEST(name) \
+ { #name, test_parsecommon_ ## name, 0, NULL, NULL }
+
+struct testcase_t parsecommon_tests[] = {
+ PARSECOMMON_TEST(tokenize_string_null),
+ END_OF_TESTCASES
+};
+
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits