Round-trip testing (source code)

= Round-trip testing

Test a conversion together with its intended inverse. Equality of representations may need normalization, while equality of numerical values can be limited by <floating-point rounding> or truncation. Distinct <strings> can encode the same value, so a value round trip and a character-for-character round trip are different properties.

An independent oracle is still needed: the wrong <functions> $f(x)=x+1$ and $g(y)=y-1$ satisfy both composition identities on <integers>, although neither implements an intended identity conversion. Thus passing inverse-consistency tests does not alone establish the specification of either conversion.