forked from irungentoo/toxcore
-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add more unit tests for
add_to_list
.
- Loading branch information
Showing
7 changed files
with
355 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
870f1e19aa3f3f802c7e53af3848df6a0f7af9ad4c98213aa1578fa325b30fad /usr/local/bin/tox-bootstrapd | ||
bc830120a87517f830eb85494b769c523bd1696328938d46e9eac1eefea61d38 /usr/local/bin/tox-bootstrapd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "DHT_test_util.h" | ||
|
||
PublicKey random_pk(const Random *rng) | ||
{ | ||
PublicKey pk; | ||
random_bytes(rng, pk.data(), pk.size()); | ||
return pk; | ||
} | ||
|
||
IP_Port random_ip_port(const Random *rng) | ||
{ | ||
IP_Port ip_port; | ||
ip_port.ip.family = net_family_ipv4(); | ||
ip_port.ip.ip.v4.uint8[0] = 192; | ||
ip_port.ip.ip.v4.uint8[1] = 168; | ||
ip_port.ip.ip.v4.uint8[2] = 0; | ||
ip_port.ip.ip.v4.uint8[3] = random_u08(rng); | ||
ip_port.port = random_u16(rng); | ||
return ip_port; | ||
} | ||
|
||
Node_format random_node_format(const Random *rng) | ||
{ | ||
Node_format node; | ||
auto const pk = random_pk(rng); | ||
std::copy(pk.begin(), pk.end(), node.public_key); | ||
node.ip_port = random_ip_port(rng); | ||
return node; | ||
} |
Oops, something went wrong.