aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/libhicnctrl/src/test/common.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ctrl/libhicnctrl/src/test/common.cc')
-rw-r--r--ctrl/libhicnctrl/src/test/common.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/ctrl/libhicnctrl/src/test/common.cc b/ctrl/libhicnctrl/src/test/common.cc
new file mode 100644
index 000000000..075281d2e
--- /dev/null
+++ b/ctrl/libhicnctrl/src/test/common.cc
@@ -0,0 +1,13 @@
+#include "common.h"
+
+std::string dump_buffer(const char *name, uint8_t *buffer, size_t size) {
+ std::ostringstream oss;
+ oss << "const std::vector<uint8_t> " << name << " = {";
+ for (size_t i = 0; i < size; i++) {
+ if (i > 0) oss << ", ";
+ oss << "0x" << std::setw(2) << std::setfill('0') << std::hex
+ << static_cast<int>(buffer[i]);
+ }
+ oss << "};" << std::endl;
+ return oss.str();
+}