Skip to content

Commit 81ca96f

Browse files
authored
[19_3] Rename as_hexadecimal to uint32_to_Hex
1 parent 64be652 commit 81ca96f

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

lolly/data/numeral.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ as_hexadecimal (int i, int len) {
303303
}
304304

305305
string
306-
as_hexadecimal (uint32_t i) {
306+
uint32_to_Hex (uint32_t i) {
307307
string result;
308308
to_Hex_positive (i, result);
309309
return result;

lolly/data/numeral.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ string as_hexadecimal (int i, int length);
9898
* @param i The integer to be converted to a hexadecimal string.
9999
* @return The hexadecimal string representation of the input integer.
100100
*/
101-
string as_hexadecimal (uint32_t i);
101+
string uint32_to_Hex (uint32_t i);
102102

103103
/**
104104
* @brief Converts a binary stream to its hexadecimal represention.

tests/lolly/data/numeral_test.cpp

+14-14
Original file line numberDiff line numberDiff line change
@@ -177,26 +177,26 @@ TEST_CASE ("as_hexadecimal fixed") {
177177
SUBCASE ("max") { string_eq (as_hexadecimal (UINT32_MAX, 8), "FFFFFFFF"); }
178178
}
179179

180-
TEST_CASE ("as_hexadecimal") {
180+
TEST_CASE ("uint32_to_Hex") {
181181
SUBCASE ("0-15 (+/-)") {
182182
for (int i= 1; i < 10; i++) {
183-
string_eq (as_hexadecimal (i), as_string (i));
184-
string_eq (as_hexadecimal (i), as_string (i));
183+
string_eq (uint32_to_Hex (i), as_string (i));
184+
string_eq (uint32_to_Hex (i), as_string (i));
185185
}
186-
string_eq (as_hexadecimal (0), "0");
187-
string_eq (as_hexadecimal (10), "A");
188-
string_eq (as_hexadecimal (11), "B");
189-
string_eq (as_hexadecimal (12), "C");
190-
string_eq (as_hexadecimal (13), "D");
191-
string_eq (as_hexadecimal (14), "E");
192-
string_eq (as_hexadecimal (15), "F");
186+
string_eq (uint32_to_Hex (0), "0");
187+
string_eq (uint32_to_Hex (10), "A");
188+
string_eq (uint32_to_Hex (11), "B");
189+
string_eq (uint32_to_Hex (12), "C");
190+
string_eq (uint32_to_Hex (13), "D");
191+
string_eq (uint32_to_Hex (14), "E");
192+
string_eq (uint32_to_Hex (15), "F");
193193
}
194194
SUBCASE ("arbitary") {
195-
string_eq (as_hexadecimal (0x12), "12");
196-
string_eq (as_hexadecimal (0xABC), "ABC");
197-
string_eq (as_hexadecimal (0x80000001), "80000001");
195+
string_eq (uint32_to_Hex (0x12), "12");
196+
string_eq (uint32_to_Hex (0xABC), "ABC");
197+
string_eq (uint32_to_Hex (0x80000001), "80000001");
198198
}
199-
SUBCASE ("max") { string_eq (as_hexadecimal (UINT32_MAX), "FFFFFFFF"); }
199+
SUBCASE ("max") { string_eq (uint32_to_Hex (UINT32_MAX), "FFFFFFFF"); }
200200
}
201201

202202
TEST_CASE ("binary to hexadecimal") {

0 commit comments

Comments
 (0)