aboutsummaryrefslogtreecommitdiff
path: root/test/str_ut.c
diff options
context:
space:
mode:
authorSimon Glass2021-07-24 09:03:32 -0600
committerTom Rini2021-08-02 13:32:14 -0400
commit96b23440c1b74cd95022e3ebb08a60fedb04f3b9 (patch)
tree468fe008d651886455b680de0376a01b7fdee160 /test/str_ut.c
parent18546f2982bc2032276759530328725ec4561454 (diff)
lib: Drop unnecessary check for hex digit
If we see 0x then we can assume this is the start of a hex value. It does not seem necessary to check for a hex digit after that since it will happen when parsing the value anyway. Drop this check to simplify the code and reduce size. Add a few more test cases for when a 0x prefix is used. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/str_ut.c')
-rw-r--r--test/str_ut.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/str_ut.c b/test/str_ut.c
index 19f2c127135..8133b213bfa 100644
--- a/test/str_ut.c
+++ b/test/str_ut.c
@@ -84,6 +84,8 @@ static int str_simple_strtoul(struct unit_test_state *uts)
/* Base 10 and base 16 */
ut_assertok(run_strtoul(uts, str2, 10, 1099, 4, upper));
ut_assertok(run_strtoul(uts, str2, 16, 0x1099ab, 6, upper));
+ ut_assertok(run_strtoul(uts, str3, 16, 0xb, 3, upper));
+ ut_assertok(run_strtoul(uts, str3, 10, 0, 1, upper));
/* Invalid string */
ut_assertok(run_strtoul(uts, str1, 10, 0, 0, upper));