Add common data structures

This adds some common data structures and functions needed for RDE BEJ.

The decoder core is written in C so that we can use this with some other
future platforms.
clang-tidy is complaining about C style header. I tried adding a
.clang-tidy-ignore file but it did not work. And since this is mainly a
C library, I deleted the .clang-tidy.

Signed-off-by: Kasun Athukorala <kasunath@google.com>
Change-Id: Ice07527b23cd00c65cd11ed114ea4faefcc085fb
diff --git a/test/rde_common_test.cpp b/test/rde_common_test.cpp
new file mode 100644
index 0000000..3217ffd
--- /dev/null
+++ b/test/rde_common_test.cpp
@@ -0,0 +1,39 @@
+#include "rde_common.h"
+
+#include <gmock/gmock-matchers.h>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+namespace rde
+{
+
+TEST(RdeCommonTest, RdeGetUnsignedIntegerTest)
+{
+    constexpr uint8_t bytes[] = {0xab, 0xcd, 0xef, 0x12,
+                                 0x13, 0x65, 0x23, 0x89};
+    EXPECT_THAT(rdeGetUnsignedInteger(bytes, /*numOfBytes=*/1), 0xab);
+    EXPECT_THAT(rdeGetUnsignedInteger(bytes, /*numOfBytes=*/2), 0xcdab);
+    EXPECT_THAT(rdeGetUnsignedInteger(bytes, /*numOfBytes=*/5), 0x1312efcdab);
+    EXPECT_THAT(rdeGetUnsignedInteger(bytes, /*numOfBytes=*/8),
+                0x8923651312efcdab);
+}
+
+TEST(RdeCommonTest, RdeGetNnintTest)
+{
+    constexpr uint8_t nnint1[] = {0x03, 0xcd, 0xef, 0x12};
+    constexpr uint8_t nnint2[] = {0x08, 0xab, 0xcd, 0xef, 0x12,
+                                  0x13, 0x65, 0x23, 0x89};
+    EXPECT_THAT(rdeGetNnint(nnint1), 0x12efcd);
+    EXPECT_THAT(rdeGetNnint(nnint2), 0x8923651312efcdab);
+}
+
+TEST(RdeCommonTest, RdeGetNnintSizeTest)
+{
+    constexpr uint8_t nnint1[] = {0x03, 0xcd, 0xef, 0x12};
+    constexpr uint8_t nnint2[] = {0x08, 0xab, 0xcd, 0xef, 0x12,
+                                  0x13, 0x65, 0x23, 0x89};
+    EXPECT_THAT(rdeGetNnintSize(nnint1), 4);
+    EXPECT_THAT(rdeGetNnintSize(nnint2), 9);
+}
+
+} // namespace rde