mbox series

[v4,0/2] t/: port helper/test-{sha1, sha256} to unit-tests/t-hash

Message ID 20240526084345.24138-1-shyamthakkar001@gmail.com (mailing list archive)
Headers show
Series t/: port helper/test-{sha1, sha256} to unit-tests/t-hash | expand

Message

Ghanshyam Thakkar May 26, 2024, 8:43 a.m. UTC
Changes in v4:
- introduce new generic macros TEST_HASH_{STR, LITERAL} which accept
  both expected SHA-1 and expected SHA-256 for the same input, according
  to Patrick's feedback. A partial refactoring of check_hash_data() was 
  done for this.
- As a consequence to above, add a missing SHA-1 value for 'abc...xyz' 100000
  times, which was present for SHA-256
- improve the BUG statement

CI: https://github.com/spectre10/git/actions/runs/9241430375

Ghanshyam Thakkar (2):
  strbuf: introduce strbuf_addstrings() to repeatedly add a string
  t/: migrate helper/test-{sha1, sha256} to unit-tests/t-hash

 Makefile                    |  1 +
 builtin/submodule--helper.c |  4 +-
 json-writer.c               |  5 +--
 strbuf.c                    |  9 ++++
 strbuf.h                    |  5 +++
 t/t0015-hash.sh             | 56 ------------------------
 t/unit-tests/t-hash.c       | 86 +++++++++++++++++++++++++++++++++++++
 7 files changed, 103 insertions(+), 63 deletions(-)
 delete mode 100755 t/t0015-hash.sh
 create mode 100644 t/unit-tests/t-hash.c

Range-diff against v3:
1:  cd831fabf5 = 1:  cd831fabf5 strbuf: introduce strbuf_addstrings() to repeatedly add a string
2:  2c4471ce37 < -:  ---------- t/: port helper/test-sha1.c to unit-tests/t-hash.c
3:  68dcf388d8 < -:  ---------- t/: port helper/test-sha256.c to unit-tests/t-hash.c
-:  ---------- > 2:  ea7e171014 t/: migrate helper/test-{sha1, sha256} to unit-tests/t-hash