Running the following test....
#[test]
fn convertFromHexToDec_() {
let input = "0123456789abcdef"; // 81985529216486895 in decimal
let fromBase = 16u8;
let toBase = 10u8;
let result = convertBase(input, fromBase, toBase);
println!("{} len:{}",result, result.len()); //prints: 81985529216486895 len:17
let expResult = "81985529216486895<U+202C>";
println!("{} len:{}",expResult, expResult.len()); //prints: 81985529216486895 len:20
assert_eq!(expResult, result);
}
.... I get an unexpected message. The cause is not the result of my (correct) function I am testing here but the unexpected modification of the &str on the left side of assert_eq:
panics with this message:
thread 'HexToDecString::tests::convertBase_test2' panicked at 'assertion failed: `(left == right)`
left: `"81985529216486895\u{202c}"`,
right: `"81985529216486895"`'
The same problem with expResult.to_string() or comparing format!("{}", expResult) with the result.
Once I got this message:
left: `"\u{202d}81985529216486895\u{202c}"`,
Where do the unicode characters u+202d and u+202c "left-to-right-override" and "pop directional formatting" come from? It seems that assert_eq! adds them to the &str on the left side.
Any ideas?
I am using IntelliJ 2019.1.2 (last updated today), with the latest stable rust version.