Friday, December 18, 2009

Numeric Input Fields

Here's a simple tip for testing numeric input fields: Try octal numbers.

Provide input in the form of digits 0-7, with the first digit always being 0. Hence 011 is a valid octal number (decimal equivalent of 9).

If your app treats "011" as 9, then there's probably a call to ParseInt() which omits the numeric base argument. In some languages, ParseInt() guesses the likely numeric base for the provided input if one isn't specified. So 011 becomes 9.

1 comment: