core/util: Fix sign issue, clean up code

"- 123" would parse as -123, despite space between minus sign and actual
number. "- 123" now properly parses as a positive integer; the negative
multiplier is set for each non-digit character parsed.
tests/core/string: Make string_to_int_test() func

Also checks for expected integer result parsed from the string, and
warns on errors as needed.