Merge #21438: test: add ParseUInt8() test coverage

76782e560b refactor: reuse test string with embedded null char in util_tests (Jon Atack)
24c6546946 test: add ParseUInt8() unit and fuzz test coverage (Jon Atack)

Pull request description:

  We have unit test and fuzzer coverage for
  - `ParseInt64()`
  - `ParseInt32()`
  - `ParseUInt64()`
  - `ParseUInt32()`

  but not `ParseUInt8()`, so this pull adds it.

  I was tempted to add a commit that applies clang formatting to the file, or one that updates the C-style casts to named casts, but resisted the temptation unless reviewers request it.

ACKs for top commit:
  laanwj:
    Code review ACK 76782e560b
  MarcoFalke:
    cr ACK 76782e560b

Tree-SHA512: 1d7948b3385632094a3b0f0e38f87dccddabf74002e68aa055a51408866b057828ffa15c4b22aa9adde458155fbb5e443b66a9dbf3d7713358fc98a14d64bdcf
This commit is contained in:
Wladimir J. van der Laan
2021-03-16 11:57:47 +01:00
2 changed files with 46 additions and 16 deletions

View File

@@ -18,6 +18,9 @@ FUZZ_TARGET(parse_numbers)
double d;
(void)ParseDouble(random_string, &d);
uint8_t u8;
(void)ParseUInt8(random_string, &u8);
int32_t i32;
(void)ParseInt32(random_string, &i32);
(void)atoi(random_string);