From 118bba7622ab15ea5c58ff32be178820150423ba Mon Sep 17 00:00:00 2001 From: "Chelsea H. Komlo" Date: Wed, 2 Nov 2016 09:45:02 -0500 Subject: Refactor to remove unnecessary check in circuit_is_available_for_use --- src/test/test_circuituse.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/test/test_circuituse.c') diff --git a/src/test/test_circuituse.c b/src/test/test_circuituse.c index 23f1f9c6d2..edbc9f6391 100644 --- a/src/test/test_circuituse.c +++ b/src/test/test_circuituse.c @@ -46,7 +46,21 @@ test_circuit_is_available_for_use_ret_false_for_non_general_purpose(void *arg) (void)arg; circuit_t *circ = tor_malloc(sizeof(circuit_t)); - circ->purpose = CIRCUIT_PURPOSE_OR; + circ->purpose = CIRCUIT_PURPOSE_REND_POINT_WAITING; + + tt_int_op(0, ==, circuit_is_available_for_use(circ)); + + done: + tor_free(circ); +} + +static void +test_circuit_is_available_for_use_ret_false_for_non_general_origin(void *arg) +{ + (void)arg; + + circuit_t *circ = tor_malloc(sizeof(circuit_t)); + circ->purpose = CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT; tt_int_op(0, ==, circuit_is_available_for_use(circ)); @@ -235,6 +249,10 @@ struct testcase_t circuituse_tests[] = { test_circuit_is_available_for_use_ret_false_for_non_general_purpose, TT_FORK, NULL, NULL }, + { "non_general", + test_circuit_is_available_for_use_ret_false_for_non_general_origin, + TT_FORK, NULL, NULL + }, { "origin", test_circuit_is_available_for_use_ret_false_for_non_origin_purpose, TT_FORK, NULL, NULL -- cgit v1.2.3-54-g00ecf