libcruft-util/test/ip.cpp
Danny Robson 52f53caee5 debug: drop support for CHECK_HARD
HARD vs SOFT assertions were never very well defined or supported.
Currently they just imply a level of functionality that isn't present;
it's better to remove them instead of expending the effort at this
point.
2015-01-28 14:49:34 +11:00

31 lines
619 B
C++

#include "../ip.hpp"
#include "../debug.hpp"
#include "../platform.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);
}
return EXIT_SUCCESS;
}