Skip to content

Improved test coverage - #16

Merged
ShadobaDev merged 4 commits into
masterfrom
claude/add-unit-tests-coverage-excyd6
Nov 4, 2026
Merged

ShadobaDev merged 4 commits into
masterfrom
claude/add-unit-tests-coverage-excyd6

Conversation

@ShadobaDev

Copy link
Copy Markdown
Owner

Fruits of claude --cloud 100$ session included credits. Improved test coverage.

claude and others added 4 commits November 3, 2026 22:31
A new test file aimed at branch (C1) coverage: each NULL argument of the
row, resource and block-settings functions and of decode_mask on its own;
counts at the edge of overflow (a size_t count past UINT32_MAX, 0xFFFFFFFF
guides, 0xFFFFFFFF UTF-16 units); empty lists, cursors outside a list,
buffers one byte short; the float helpers at infinity, NaN and DBL_MAX,
and channel ids mapped to slots at the limits.

Branches 95.7% -> 96.9%; builders.h, views.h, detail/floats.h at 100%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019egXEpyVAm2D3tvQn2Xcuv
…r's untaken branches

Files built with the reader tests' PSD builder (malformed ones are made in
code, as the others are) and documents with crafted kept bytes:

- reader: pixel aspect ratios that are not positive (0, -1, inf, NaN) and a
  duplicate 1064; bitmap at 8 bits and greyscale at 1 bit; a composite alpha
  without its channel; a stored composite short of colour channels; layers and
  masks without height or width; a mask that does not decode, and the same
  asked for no rows; channel data past the layer info; a PSB layer taller
  than any format allows; multichannel filling every plane; a fully
  transparent 32-bit pixel un-matted; 'Mtrn'/'Mt16' and a short tail
- writer: a kept resource name without data, an inverted mask, 32-bit
  greyscale, multichannel given pixels or no channel count, a kept tail ending
  in stray bytes (8BIM, 8B64, a cut PSB long-key header) kept or converted,
  and a kept 'lsct' too short for its type

Branches 96.9% -> 98.2% (read.h 92% -> 97%, reader.h 97% -> 99%, writer.h
95% -> 96%); clean under clang-tidy and AddressSanitizer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019egXEpyVAm2D3tvQn2Xcuv
…om the test report

- writer: mpsd__alpha_uncounted no longer repeats the flat-mode check composite_alpha makes
- read: minipsd_read's alignment check is reachable with a MINIPSD_MALLOC that aligns less than
  malloc; documented (header, SPECIFICATION, MANUAL, CHANGELOG) and tested in
  test_alloc_failure.cpp
- reader: comments on the window's base and on next_layer's guard; init's doc says later data
  is checked as it is read
- tests: GoogleTest pinned by hash; targetOf takes 32 bits; offline note in CHEATSHEET
- ci: branch coverage threshold 95 -> 97 % (98.3 % measured)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- writer: clang-analyzer 22 (CI's) took the mask channel's source for a layer without a mask,
  after the crafted writer tests; mpsd__channel_count counts that channel only with a mask, so
  the finding is suppressed with that reason
- ci: the C++ compile checks' (*_check.cpp, built, never run) coverage data left out, as the C
  units' are: their functions, never called, listed beside the tests' under their C names
  (functions 85 -> 100 %)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ShadobaDev
ShadobaDev merged commit 345aab8 into master Nov 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants