summaryrefslogtreecommitdiff
path: root/test/test.cpp
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhsoting.net>2019-04-26 17:58:14 +0200
committerJörg Frings-Fürst <debian@jff-webhsoting.net>2019-04-26 17:58:14 +0200
commitfddb419b78bc873fb6fb9e8dc49c28e5ac5113f1 (patch)
tree3009ac597dd206aa4bfaa50725ed6e7542119877 /test/test.cpp
parent4c6be44409a51e938aa1c9e4d920348d5317a3d2 (diff)
parent5444b1728ba7cfc55e85fd3022b6e88c9441327c (diff)
Merge branch 'feature/upstream' into develop
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);