| 1 | fn test_hex_methods_on_u8() { |
| 2 | assert u8(1).hex() == '01' |
| 3 | assert u8(` `).hex() == '20' |
| 4 | assert u8(255).hex() == 'ff' |
| 5 | } |
| 6 | |
| 7 | fn test_hex_methods_on_byte() { |
| 8 | assert byte(1).hex() == '01' |
| 9 | assert byte(` `).hex() == '20' |
| 10 | assert byte(255).hex() == 'ff' |
| 11 | } |
| 12 | |
| 13 | fn test_hex_methods_on_char() { |
| 14 | assert char(1).hex() == '01' |
| 15 | assert char(` `).hex() == '20' |
| 16 | assert char(255).hex() == 'ff' |
| 17 | } |
| 18 | |
| 19 | fn test_hex_method_on_runes() { |
| 20 | assert ` `.hex() == '20' |
| 21 | assert `喂`.hex() == '5582' |
| 22 | // latin: |
| 23 | assert `A`.hex() == '41' |
| 24 | assert `Z`.hex() == '5a' |
| 25 | // cyrillic: |
| 26 | assert `Д`.hex() == '414' |
| 27 | assert `Я`.hex() == '42f' |
| 28 | // emojies: |
| 29 | assert `💣`.hex() == '1f4a3' |
| 30 | } |
| 31 | |