]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Added inttoa tests.
authorLinux Karlsson <karlsson@ntp.org>
Tue, 15 Jun 2010 10:05:16 +0000 (12:05 +0200)
committerLinux Karlsson <karlsson@ntp.org>
Tue, 15 Jun 2010 10:05:16 +0000 (12:05 +0200)
bk: 4c17505cDDH6dLx17Z3lgixT3UeNVg

tests/libntp/Makefile.am
tests/libntp/inttoa.cpp [new file with mode: 0644]

index ff6f24dd6b009a69e9fcfd05c361231cfc159198..f20880edf8e4026aabbf4d7221ffdffaabbb1e2f 100644 (file)
@@ -13,6 +13,7 @@ tests_SOURCES = ../main.cpp           \
                decodenetnum.cpp        \
                hextoint.cpp            \
                hextolfp.cpp            \
+               inttoa.cpp              \
                lfptostr.cpp            \
                sfptostr.cpp
 
diff --git a/tests/libntp/inttoa.cpp b/tests/libntp/inttoa.cpp
new file mode 100644 (file)
index 0000000..05ea88c
--- /dev/null
@@ -0,0 +1,24 @@
+#include "libntptest.h"
+
+class inttoaTest : public libntptest {
+};
+
+TEST_F(inttoaTest, RegularNumber) {
+       EXPECT_STREQ("42", inttoa(42));
+}
+
+TEST_F(inttoaTest, NegativeNumber) {
+       EXPECT_STREQ("-3", inttoa(-3));
+}
+
+TEST_F(inttoaTest, BigPositiveNumber) {
+       EXPECT_STREQ("2147483647", inttoa(2147483647));
+}
+
+TEST_F(inttoaTest, BigNegativeNumber) {
+       EXPECT_STREQ("-2147483648", inttoa(-2147483648));
+}
+
+TEST_F(inttoaTest, MediumNumber) {
+       EXPECT_STREQ("20000001", inttoa(20000001));
+}