From 131039f6330f4c1a4a36f0b4d381f0033b9ecf46 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 4 Jul 2024 13:06:30 +0300 Subject: test: utils: Extend utils::hex() test to 8-bit and 16-bit values Now that the utils::hex() function supports 8-bit and 16-bit integers, extend the unit test to cover them. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Stefan Klug --- test/utils.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/utils.cpp b/test/utils.cpp index 41af954b..d25475cb 100644 --- a/test/utils.cpp +++ b/test/utils.cpp @@ -176,6 +176,14 @@ protected: std::ostringstream os; std::string ref; + os << utils::hex(static_cast(0x42)) << " "; + ref += "0x42 "; + os << utils::hex(static_cast(0x42)) << " "; + ref += "0x42 "; + os << utils::hex(static_cast(0x42)) << " "; + ref += "0x0042 "; + os << utils::hex(static_cast(0x42)) << " "; + ref += "0x0042 "; os << utils::hex(static_cast(0x42)) << " "; ref += "0x00000042 "; os << utils::hex(static_cast(0x42)) << " "; @@ -184,6 +192,15 @@ protected: ref += "0x0000000000000042 "; os << utils::hex(static_cast(0x42)) << " "; ref += "0x0000000000000042 "; + + os << utils::hex(static_cast(0x42), 6) << " "; + ref += "0x000042 "; + os << utils::hex(static_cast(0x42), 1) << " "; + ref += "0x42 "; + os << utils::hex(static_cast(0x42), 6) << " "; + ref += "0x000042 "; + os << utils::hex(static_cast(0x42), 1) << " "; + ref += "0x42 "; os << utils::hex(static_cast(0x42), 4) << " "; ref += "0x0042 "; os << utils::hex(static_cast(0x42), 1) << " "; -- cgit v1.2.1