libcruft-util/test/ip.cpp

33 lines
661 B
C++
Raw Normal View History

2015-04-13 16:45:56 +10:00
#include "ip.hpp"
2015-04-13 16:45:56 +10:00
#include "debug.hpp"
#include "platform.hpp"
#include "tap.hpp"
#include "types.hpp"
#include <cstdlib>
using namespace std;
int
main (int, char **) {
struct ip_test {
const char *str;
const ipv4::ip ip;
} data [] = {
{ "0.0.0.0", { 0, 0, 0, 0 } },
{ "255.255.255.255", { 255, 255, 255, 255 } },
{ "127.0.0.1", { 127, 0, 0, 1 } }
};
for (unsigned int i = 0; i < elems (data); ++i) {
ipv4::ip parsed (ipv4::ip::parse (data[i].str));
CHECK (parsed == data[i].ip);
}
2015-04-13 16:45:56 +10:00
util::TAP::logger tap;
tap.todo ("convert to TAP");
}