From 00d0d2d092efe2785f06f1deefb38f7005140c1d Mon Sep 17 00:00:00 2001
From: Daniel M <daniel.q.mueller@stud.h-da.de>
Date: Tue, 4 May 2021 01:10:12 +0200
Subject: [PATCH] Add doxygen docu for gitlab-pages

- Build and update doxygen documentation and deploy to gitlab-pages.
- Also run the tests (without analysis for now)
---
 .gitlab-ci.yml | 24 ++++++++++++++++++++++++
 Doxyfile       |  1 +
 README.md      |  6 ++++++
 test/test.cpp  |  4 ++--
 4 files changed, 33 insertions(+), 2 deletions(-)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..bd5decd
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,24 @@
+image: alpine
+
+variables:
+  GIT_SUBMODULE_STRATEGY: recursive
+
+pages:
+  script:
+  - apk update && apk add doxygen ttf-freefont graphviz
+  - doxygen 
+  - mv docs/html/ public/
+  artifacts:
+    paths:
+    - public
+  only:
+  - master
+
+run tests:
+  script:
+  - apk update && apk add g++ make cmake
+  - cd build
+  - cmake ..
+  - make test
+  only:
+  - master
\ No newline at end of file
diff --git a/Doxyfile b/Doxyfile
index 931666d..6c36f6d 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -830,6 +830,7 @@ WARN_LOGFILE           =
 # Note: If this tag is empty the current directory is searched.
 
 INPUT                  = src
+INPUT                 += inc
 INPUT                 += README.md
 
 # This tag can be used to specify the character encoding of the source files
diff --git a/README.md b/README.md
index ac1e2e3..c35a8be 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,12 @@ Instead Ip-Addresses are simply specified as `string` and ports as `uint16_t`
 (in host byte order). All the conversions and Ipv4/Ipv6 differences are handled 
 behind the scenes.
 
+## Documentation
+
+Doxygen documentation of the public API is available on [gitlab-pages](https://istddmue2.h-da.io/netlib). 
+
+Some examples using the library are available in the `example` subdirectory.
+
 ## Usage
 
 This library can be used in many different ways. The most simple of which would 
diff --git a/test/test.cpp b/test/test.cpp
index 4deee8c..2fe4d83 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -57,7 +57,7 @@ TEST_CASE("Test IpAddr automatic version") {
     bool raw_ip_equal = true;
     for (auto i = 0; i < 16; i++)
     {
-        if (ipv6.raw_addr.v6.__in6_u.__u6_addr8[i] != addrV6bytes[i] )
+        if (((uint8_t*)&ipv6.raw_addr.v6)[i] != addrV6bytes[i] )
             raw_ip_equal = false;
     }
 
@@ -185,7 +185,7 @@ TEST_CASE("Test SockAddr from raw_sockaddr") {
 
     raw6.sin6_family = AF_INET6;
     raw6.sin6_port = htons(1337);
-    memcpy(&raw6.sin6_addr.__in6_u.__u6_addr8[0], ip6_bytes, 16);
+    memcpy(&raw6.sin6_addr, ip6_bytes, 16);
 
     SockAddr sa6((sockaddr*) &raw6, IpAddr::Type::V6);
 
-- 
GitLab