Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tor
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Core
debian
tor
Commits
39ff3b00
Commit
39ff3b00
authored
11 years ago
by
Qingping Hou
Browse files
Options
Downloads
Patches
Plain Diff
add test for node_get_verbose_nickname_by_id
parent
0fbe7f31
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/test/include.am
+1
-0
1 addition, 0 deletions
src/test/include.am
src/test/test.c
+2
-0
2 additions, 0 deletions
src/test/test.c
src/test/test_nodelist.c
+40
-0
40 additions, 0 deletions
src/test/test_nodelist.c
with
43 additions
and
0 deletions
src/test/include.am
+
1
−
0
View file @
39ff3b00
...
...
@@ -39,6 +39,7 @@ src_test_test_SOURCES = \
src/test/test_util.c \
src/test/test_config.c \
src/test/test_hs.c \
src/test/test_nodelist.c \
src/ext/tinytest.c
src_test_test_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
...
...
This diff is collapsed.
Click to expand it.
src/test/test.c
+
2
−
0
View file @
39ff3b00
...
...
@@ -1626,6 +1626,7 @@ extern struct testcase_t controller_event_tests[];
extern
struct
testcase_t
logging_tests
[];
extern
struct
testcase_t
backtrace_tests
[];
extern
struct
testcase_t
hs_tests
[];
extern
struct
testcase_t
nodelist_tests
[];
static
struct
testgroup_t
testgroups
[]
=
{
{
""
,
test_array
},
...
...
@@ -1650,6 +1651,7 @@ static struct testgroup_t testgroups[] = {
{
"extorport/"
,
extorport_tests
},
{
"control/"
,
controller_event_tests
},
{
"hs/"
,
hs_tests
},
{
"nodelist/"
,
nodelist_tests
},
END_OF_GROUPS
};
...
...
This diff is collapsed.
Click to expand it.
src/test/test_nodelist.c
0 → 100644
+
40
−
0
View file @
39ff3b00
/* Copyright (c) 2007-2013, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
* \file test_nodelist.c
* \brief Unit tests for nodelist related functions.
**/
#include
"or.h"
#include
"nodelist.h"
#include
"test.h"
/** Tese the case when node_get_by_id() returns NULL,
* node_get_verbose_nickname_by_id should return the base 16 encoding
* of the id.
*/
static
void
test_nodelist_node_get_verbose_nickname_by_id_null_node
(
void
*
arg
)
{
char
vname
[
MAX_VERBOSE_NICKNAME_LEN
+
1
];
const
char
ID
[]
=
"
\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA
"
"
\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA
"
;
(
void
)
arg
;
/* make sure node_get_by_id returns NULL */
test_assert
(
!
node_get_by_id
(
ID
));
node_get_verbose_nickname_by_id
(
ID
,
vname
);
test_streq
(
vname
,
"$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
);
done:
return
;
}
#define NODE(name, flags) \
{ #name, test_nodelist_##name, (flags), NULL, NULL }
struct
testcase_t
nodelist_tests
[]
=
{
NODE
(
node_get_verbose_nickname_by_id_null_node
,
TT_FORK
),
END_OF_TESTCASES
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment