check leading zeros for integers and add some tests

Signed-off-by: Wang Zhen <lazybetrayer@gmail.com>