Cpp-Processing
utils-tests.h
1 #define CATCH_CONFIG_MAIN
2 #include <catch2/catch_test_macros.hpp>
3 #include "byte-utils.h"
4 #include <iostream>
5 
6 TEST_CASE("byte to hex", "[core]") {
7  unsigned char byte = 0xAB; // Example byte
8  std::string hex_str = celantur::byte_to_hex(byte);
9  REQUIRE(hex_str == "ab");
10 }
11 
12 TEST_CASE("bytes to hex", "[core]") {
13  unsigned char bytes[] = { 0xAB, 0xCD, 0xEF}; // Example bytes
14  std::string hex_str = celantur::bytes_to_hex(bytes, sizeof(bytes));
15  REQUIRE(hex_str == "abcdef");
16 }