aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_protover.c
AgeCommit message (Collapse)Author
2018-04-02tests: Run all existing protover tests in both languages.Isis Lovecruft
There's now no difference in these tests w.r.t. the C or Rust: both fail miserably (well, Rust fails with nice descriptive errors, and C gives you a traceback, because, well, C).
2018-04-02tests: Make inline comments in test_protover.c more accurate.Isis Lovecruft
The DoS potential is slightly higher in C now due to some differences to the Rust code, see the C_RUST_DIFFERS tags in src/rust/protover/tests/protover.rs. Also, the comment about "failing at the splitting stage" in Rust wasn't true, since when we split, we ignore empty chunks (e.g. "1--1" parses into "(1,None),(None,1)" and "None" can't be parsed into an integer). Finally, the comment about "Rust seems to experience an internal error" is only true in debug mode, where u32s are bounds-checked at runtime. In release mode, code expressing the equivalent of this test will error with `Err(ProtoverError::Unparseable)` because 4294967295 is too large.
2018-04-02protover: Change protover_all_supported() to return only unsupported.Isis Lovecruft
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".
2018-03-01Merge branch 'maint-0.3.2' into maint-0.3.3Nick Mathewson
2018-03-01Merge branch 'maint-0.3.1' into maint-0.3.2Nick Mathewson
2018-03-01Merge branch 'maint-0.2.9' into maint-0.3.1Nick Mathewson
2018-03-01Protover tests: disable some obsoleted testsNick Mathewson
These were meant to demonstrate old behavior, or old rust behavior. One of them _should_ work in Rust, but won't because of implementation details. We'll fix that up later.
2018-03-01Forbid UINT32_MAX as a protocol versionNick Mathewson
The C code and the rust code had different separate integer overflow bugs here. That suggests that we're better off just forbidding this pathological case. Also, add tests for expected behavior on receiving a bad protocol list in a consensus. Fixes another part of 25249.
2018-03-01Forbid "-0" as a protocol version.Nick Mathewson
Fixes part of 24249; bugfix on 0.2.9.4-alpha.
2018-03-01Add more of Teor's protover tests.Nick Mathewson
These are as Teor wrote them; I've disabled the ones that don't pass yet, with XXXX comments.
2018-03-01Add some protover vote round-trip tests from Teor.Nick Mathewson
I've refactored these to be a separate function, to avoid tricky merge conflicts. Some of these are disabled with "XXXX" comments; they should get fixed moving forward.
2018-01-30Add unit tests for supported protocolsteor
Prevents future regressions like #25070.
2017-11-09Merge branch 'ticket20895'Nick Mathewson
2017-10-27rust implementation of protoverChelsea Holland Komlo
2017-09-11Add a function to check for support for "protocol X or later"Nick Mathewson
Also, add unit tests for this new function and for the regular "does this list include support for protocol X" code.
2017-08-24apply ahf's test_assert_null.cocciNick Mathewson
2017-03-15Run the copyright update script.Nick Mathewson
2016-09-26Rename compute_protover_vote to protover_compute_voteNick Mathewson
2016-09-26Clean whitespace, add missing documentationNick Mathewson
2016-09-26Cover the error cases of parsing protocol versionsNick Mathewson
Also, detect an additional failure type. Thanks, tests! (How distinctly I recall thee)
2016-09-26Unit tests for protover_all_supportedNick Mathewson
2016-09-26Basic backend for the protocol-versions voting algorithm.Nick Mathewson
[This is a brute-force method that potentially uses way too much RAM. Need to rethink this a little. Right now you can DOS an authority by saying "Foo=1-4294967295".]
2016-09-26checkpoint basic protover backendNick Mathewson