summaryrefslogtreecommitdiff
path: root/src/test/test_protover.c
diff options
context:
space:
mode:
authorIsis Lovecruft <isis@torproject.org>2018-03-27 16:59:49 +0000
committerIsis Lovecruft <isis@torproject.org>2018-04-02 19:59:12 +0000
commitad369313f87cba286a4f3347553e7322608dbd9c (patch)
treeee89a875dd6c6321e5aeece6de6612bdcb5a34e5 /src/test/test_protover.c
parentcd28b4c7f5cefd319d6ded635d25911b4323b50b (diff)
downloadtor-ad369313f87cba286a4f3347553e7322608dbd9c.tar.gz
tor-ad369313f87cba286a4f3347553e7322608dbd9c.zip
protover: Change protover_all_supported() to return only unsupported.
Previously, if "Link=1-5" was supported, and you asked protover_all_supported() (or protover::all_supported() in Rust) if it supported "Link=3-999", the C version would return "Link=3-999" and the Rust would return "Link=6-999". These both behave the same now, i.e. both return "Link=6-999".
Diffstat (limited to 'src/test/test_protover.c')
-rw-r--r--src/test/test_protover.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/test/test_protover.c b/src/test/test_protover.c
index c343e9957d..95cc5f083e 100644
--- a/src/test/test_protover.c
+++ b/src/test/test_protover.c
@@ -254,8 +254,23 @@ test_protover_all_supported(void *arg)
tt_assert(! protover_all_supported("Link=3-4 Wombat=9", &msg));
tt_str_op(msg, OP_EQ, "Wombat=9");
tor_free(msg);
+
+ /* Mix of things we support and don't support within a single protocol
+ * which we do support */
tt_assert(! protover_all_supported("Link=3-999", &msg));
- tt_str_op(msg, OP_EQ, "Link=3-999");
+ tt_str_op(msg, OP_EQ, "Link=6-999");
+ tor_free(msg);
+ tt_assert(! protover_all_supported("Link=1-3,345-666", &msg));
+ tt_str_op(msg, OP_EQ, "Link=345-666");
+ tor_free(msg);
+ tt_assert(! protover_all_supported("Link=1-3,5-12", &msg));
+ tt_str_op(msg, OP_EQ, "Link=6-12");
+ tor_free(msg);
+
+ /* Mix of protocols we do support and some we don't, where the protocols
+ * we do support have some versions we don't support. */
+ tt_assert(! protover_all_supported("Link=1-3,5-12 Quokka=9000-9001", &msg));
+ tt_str_op(msg, OP_EQ, "Link=6-12 Quokka=9000-9001");
tor_free(msg);
/* CPU/RAM DoS loop: Rust only */