Add error check, improve unit stability.
1: Check boundary
2: Check error return
3: Special input(NULL, 0, Negative)