Rename rde_common to bej_common
bej_common.h is a more consistant name than rde_common.h.
Also this repo only contains code related to BEJ encoding and decoding.
Therefore this change removes the rde related structs defind in the
bej_common.h. Those structs should be defined somewhere else (libpldm).
Signed-off-by: Kasun Athukorala <kasunath@google.com>
Change-Id: Ic296ece11efc0967366e197a8609c3c88c325610
diff --git a/test/bej_common_test.cpp b/test/bej_common_test.cpp
new file mode 100644
index 0000000..09682fb
--- /dev/null
+++ b/test/bej_common_test.cpp
@@ -0,0 +1,39 @@
+#include "bej_common.h"
+
+#include <gmock/gmock-matchers.h>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+namespace libbej
+{
+
+TEST(BejCommonTest, BejGetUnsignedIntegerTest)
+{
+ constexpr uint8_t bytes[] = {0xab, 0xcd, 0xef, 0x12,
+ 0x13, 0x65, 0x23, 0x89};
+ EXPECT_THAT(bejGetUnsignedInteger(bytes, /*numOfBytes=*/1), 0xab);
+ EXPECT_THAT(bejGetUnsignedInteger(bytes, /*numOfBytes=*/2), 0xcdab);
+ EXPECT_THAT(bejGetUnsignedInteger(bytes, /*numOfBytes=*/5), 0x1312efcdab);
+ EXPECT_THAT(bejGetUnsignedInteger(bytes, /*numOfBytes=*/8),
+ 0x8923651312efcdab);
+}
+
+TEST(BejCommonTest, BejGetNnintTest)
+{
+ constexpr uint8_t nnint1[] = {0x03, 0xcd, 0xef, 0x12};
+ constexpr uint8_t nnint2[] = {0x08, 0xab, 0xcd, 0xef, 0x12,
+ 0x13, 0x65, 0x23, 0x89};
+ EXPECT_THAT(bejGetNnint(nnint1), 0x12efcd);
+ EXPECT_THAT(bejGetNnint(nnint2), 0x8923651312efcdab);
+}
+
+TEST(BejCommonTest, BejGetNnintSizeTest)
+{
+ constexpr uint8_t nnint1[] = {0x03, 0xcd, 0xef, 0x12};
+ constexpr uint8_t nnint2[] = {0x08, 0xab, 0xcd, 0xef, 0x12,
+ 0x13, 0x65, 0x23, 0x89};
+ EXPECT_THAT(bejGetNnintSize(nnint1), 4);
+ EXPECT_THAT(bejGetNnintSize(nnint2), 9);
+}
+
+} // namespace libbej
diff --git a/test/bej_dictionary_test.cpp b/test/bej_dictionary_test.cpp
index 0ca9361..0591f7d 100644
--- a/test/bej_dictionary_test.cpp
+++ b/test/bej_dictionary_test.cpp
@@ -8,7 +8,7 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-namespace rde
+namespace libbej
{
/**
@@ -104,4 +104,4 @@
bejErrorInvalidPropertyOffset);
}
-} // namespace rde
+} // namespace libbej
diff --git a/test/meson.build b/test/meson.build
index 90ccb71..8178dc1 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -17,7 +17,7 @@
gtests = [
'bej_decoder',
- 'rde_common',
+ 'bej_common',
'bej_dictionary',
]
foreach t : gtests
diff --git a/test/rde_common_test.cpp b/test/rde_common_test.cpp
deleted file mode 100644
index 3217ffd..0000000
--- a/test/rde_common_test.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-#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