summaryrefslogtreecommitdiff
path: root/test/test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/test.cpp')
-rw-r--r--test/test.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/test/test.cpp b/test/test.cpp
index 7a68c39..728e57b 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -20,11 +20,12 @@
*/
#include <uriparser/Uri.h>
+#include <uriparser/UriIp4.h>
#include <gtest/gtest.h>
#include <memory>
-#include <stdio.h>
-#include <stdlib.h>
-#include <wchar.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cwchar>
using namespace std;
@@ -2142,6 +2143,18 @@ TEST(FreeUriMembersSuite, MultiFreeWorksFine) {
uriFreeUriMembersA(&uri); // second time
}
+TEST(ParseIpFourAddressSuite, FourSaneOctets) {
+ unsigned char octetOutput[4];
+ const char * const ipAddressText = "111.22.3.40";
+ const int res = uriParseIpFourAddressA(octetOutput, ipAddressText,
+ ipAddressText + strlen(ipAddressText));
+ EXPECT_EQ(res, URI_SUCCESS);
+ EXPECT_EQ(octetOutput[0], 111);
+ EXPECT_EQ(octetOutput[1], 22);
+ EXPECT_EQ(octetOutput[2], 3);
+ EXPECT_EQ(octetOutput[3], 40);
+}
+
int main(int argc, char ** argv) {
::testing::InitGoogleTest(&argc, argv);