Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#4432 closed enhancement (implemented)

Improved test coverage of three functions in common

Reported by: 4ZM Owned by:
Priority: Medium Milestone:
Component: Core Tor/Tor Version:
Severity: Keywords: tor-client
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


Added a few tests for: hex_str, n_bits_set & eat_whitespace

3 commits on the branch 'topic/test/common_misc' @

Child Tickets

Change History (6)

comment:1 Changed 9 years ago by 4ZM

Status: newneeds_review

comment:2 Changed 9 years ago by nickm

Looks mostly good, except that I don't think that the test is right here:

+    test_streq(hex_str(binary_data, 33), "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F")
+    test_streq(hex_str(binary_data, 4711), "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F")

Note that the documentation for hex_str says "fromlen must be <= 32". No behavior is specified for fromlen > 32, so no particular behavior is required.

This isn't just a semantic point: currently, design-by-contract allows us to decide later on that hex_str() should handle fromlen up to 64 or 128, and no current correct user of hex_str() should have been relying on its current behavior for those values.

comment:3 Changed 9 years ago by 4ZM

Removed the two invalid test cases.
Renamed patch branch (and massaged some of the commits).

Current version of the patch is here:
topic/test/4432_common_misc @

comment:4 Changed 9 years ago by nickm

Resolution: implemented
Status: needs_reviewclosed

Merged onto master. Thanks!

comment:5 Changed 8 years ago by nickm

Keywords: tor-client added

comment:6 Changed 8 years ago by nickm

Component: Tor ClientTor
Note: See TracTickets for help on using tickets.