/work/toxcore/DHT_test_util.cc
Line | Count | Source (jump to first uncovered line) |
1 | | #include "DHT_test_util.hh" |
2 | | |
3 | | #include <cstring> |
4 | | #include <iomanip> |
5 | | |
6 | | #include "DHT.h" |
7 | | #include "crypto_core.h" |
8 | | #include "crypto_core_test_util.hh" |
9 | | #include "network.h" |
10 | | #include "network_test_util.hh" |
11 | | |
12 | | Node_format random_node_format(const Random *rng) |
13 | 48 | { |
14 | 48 | Node_format node; |
15 | 48 | auto const pk = random_pk(rng); |
16 | 48 | std::copy(pk.begin(), pk.end(), node.public_key); |
17 | 48 | node.ip_port = random_ip_port(rng); |
18 | 48 | return node; |
19 | 48 | } |
20 | | |
21 | | bool operator==(Node_format const &a, Node_format const &b) |
22 | 244 | { |
23 | 244 | return std::memcmp(a.public_key, b.public_key, sizeof(a.public_key)) == 0 |
24 | 244 | && a.ip_port == b.ip_port; |
25 | 244 | } |
26 | | |
27 | | std::ostream &operator<<(std::ostream &out, Node_format const &v) |
28 | 0 | { |
29 | 0 | return out << "\n Node_format{\n" |
30 | 0 | << " public_key = " << PublicKey(v.public_key) << ",\n" |
31 | 0 | << " ip_port = " << v.ip_port << " }"; |
32 | 0 | } |