diff options
Diffstat (limited to 'tests/libntp/numtohost.cpp')
-rw-r--r-- | tests/libntp/numtohost.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/libntp/numtohost.cpp b/tests/libntp/numtohost.cpp new file mode 100644 index 0000000..ffc574e --- /dev/null +++ b/tests/libntp/numtohost.cpp @@ -0,0 +1,15 @@ +#include "libntptest.h" + +class numtohostTest : public libntptest { +}; + +TEST_F(numtohostTest, LoopbackNetNonResolve) { + /* A loopback address in 127.0.0.0/8 is chosen, and + * numtohost() should not try to resolve it unless + * it is 127.0.0.1 + */ + + u_int32 input = 127*256*256*256 + 1*256 + 1; // 127.0.1.1 + + EXPECT_STREQ("127.0.1.1", numtohost(htonl(input))); +} |