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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
This commit is contained in:
parent
45bd1f20f6
commit
131039f633
1 changed files with 17 additions and 0 deletions
|
@ -176,6 +176,14 @@ protected:
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
std::string ref;
|
std::string ref;
|
||||||
|
|
||||||
|
os << utils::hex(static_cast<int8_t>(0x42)) << " ";
|
||||||
|
ref += "0x42 ";
|
||||||
|
os << utils::hex(static_cast<uint8_t>(0x42)) << " ";
|
||||||
|
ref += "0x42 ";
|
||||||
|
os << utils::hex(static_cast<int16_t>(0x42)) << " ";
|
||||||
|
ref += "0x0042 ";
|
||||||
|
os << utils::hex(static_cast<uint16_t>(0x42)) << " ";
|
||||||
|
ref += "0x0042 ";
|
||||||
os << utils::hex(static_cast<int32_t>(0x42)) << " ";
|
os << utils::hex(static_cast<int32_t>(0x42)) << " ";
|
||||||
ref += "0x00000042 ";
|
ref += "0x00000042 ";
|
||||||
os << utils::hex(static_cast<uint32_t>(0x42)) << " ";
|
os << utils::hex(static_cast<uint32_t>(0x42)) << " ";
|
||||||
|
@ -184,6 +192,15 @@ protected:
|
||||||
ref += "0x0000000000000042 ";
|
ref += "0x0000000000000042 ";
|
||||||
os << utils::hex(static_cast<uint64_t>(0x42)) << " ";
|
os << utils::hex(static_cast<uint64_t>(0x42)) << " ";
|
||||||
ref += "0x0000000000000042 ";
|
ref += "0x0000000000000042 ";
|
||||||
|
|
||||||
|
os << utils::hex(static_cast<int8_t>(0x42), 6) << " ";
|
||||||
|
ref += "0x000042 ";
|
||||||
|
os << utils::hex(static_cast<uint8_t>(0x42), 1) << " ";
|
||||||
|
ref += "0x42 ";
|
||||||
|
os << utils::hex(static_cast<int16_t>(0x42), 6) << " ";
|
||||||
|
ref += "0x000042 ";
|
||||||
|
os << utils::hex(static_cast<uint16_t>(0x42), 1) << " ";
|
||||||
|
ref += "0x42 ";
|
||||||
os << utils::hex(static_cast<int32_t>(0x42), 4) << " ";
|
os << utils::hex(static_cast<int32_t>(0x42), 4) << " ";
|
||||||
ref += "0x0042 ";
|
ref += "0x0042 ";
|
||||||
os << utils::hex(static_cast<uint32_t>(0x42), 1) << " ";
|
os << utils::hex(static_cast<uint32_t>(0x42), 1) << " ";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue