Coverage Report

Created: 2024-01-26 01:52

/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 "crypto_core_test_util.hh"
7
#include "network_test_util.hh"
8
9
Node_format random_node_format(const Random *rng)
10
48
{
11
48
    Node_format node;
12
48
    auto const pk = random_pk(rng);
13
48
    std::copy(pk.begin(), pk.end(), node.public_key);
14
48
    node.ip_port = random_ip_port(rng);
15
48
    return node;
16
48
}
17
18
bool operator==(Node_format const &a, Node_format const &b)
19
244
{
20
244
    return std::memcmp(a.public_key, b.public_key, sizeof(a.public_key)) == 0
21
244
        && a.ip_port == b.ip_port;
22
244
}
23
24
std::ostream &operator<<(std::ostream &out, Node_format const &v)
25
0
{
26
0
    return out << "\n    Node_format{\n"
27
0
               << "      public_key = " << PublicKey(v.public_key) << ",\n"
28
0
               << "      ip_port = " << v.ip_port << " }";
29
0
}