diff options
author | Isis Lovecruft <isis@torproject.org> | 2018-03-27 16:59:49 +0000 |
---|---|---|
committer | Isis Lovecruft <isis@torproject.org> | 2018-04-02 19:20:36 +0000 |
commit | 6e353664dd7c7a362be82af578954797e348d298 (patch) | |
tree | 4e1bca7ea1ea0712bfeccc45959eb5adc80ec22c /src/test | |
parent | fc2a42cc49fdcab9bbc0d90212c3c7bebda238b8 (diff) | |
download | tor-6e353664dd7c7a362be82af578954797e348d298.tar.gz tor-6e353664dd7c7a362be82af578954797e348d298.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')
-rw-r--r-- | src/test/test_protover.c | 17 |
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 */ |