From 823357dbe4874e9726749f1d9d16d85fab949ee5 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 14 Nov 2016 12:04:42 -0500 Subject: Add an entry_guard_describe() function This function helpfully removes all but one remaining use of an entry_guard_t private field in pathbias.c --- src/test/test_entrynodes.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/test/test_entrynodes.c') diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c index 781fa4d195..aa1b455ff1 100644 --- a/src/test/test_entrynodes.c +++ b/src/test/test_entrynodes.c @@ -843,6 +843,22 @@ test_node_preferred_orport(void *arg) UNMOCK(get_options); } +static void +test_entry_guard_describe(void *arg) +{ + (void)arg; + entry_guard_t g; + memset(&g, 0, sizeof(g)); + strlcpy(g.nickname, "okefenokee", sizeof(g.nickname)); + memcpy(g.identity, "theforestprimeval---", DIGEST_LEN); + + tt_str_op(entry_guard_describe(&g), OP_EQ, + "okefenokee ($746865666F726573747072696D6576616C2D2D2D)"); + + done: + ; +} + static const struct testcase_setup_t fake_network = { fake_network_setup, fake_network_cleanup }; @@ -876,6 +892,7 @@ struct testcase_t entrynodes_tests[] = { { "node_preferred_orport", test_node_preferred_orport, 0, NULL, NULL }, + { "entry_guard_describe", test_entry_guard_describe, 0, NULL, NULL }, END_OF_TESTCASES }; -- cgit v1.2.3-54-g00ecf