Skip to content

unit-tests for utils::segmented_read() and utils::segmented_write() #348

Draft
sawer297 wants to merge 5 commits intomasterfrom
SBL_Hyrax-1758_Seg-read-write-unittests
Draft

unit-tests for utils::segmented_read() and utils::segmented_write() #348
sawer297 wants to merge 5 commits intomasterfrom
SBL_Hyrax-1758_Seg-read-write-unittests

Conversation

@sawer297
Copy link
Copy Markdown
Contributor

@sawer297 sawer297 commented Apr 1, 2026

Reference ticket: HYRAX-1758

Tasks

  • Ticket exists and is linked in title
  • Tests added/updated
  • Dead code removed
  • No TODOs added

@sawer297 sawer297 self-assigned this Apr 1, 2026
Copy link
Copy Markdown
Member

@jgallagher59701 jgallagher59701 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; pending one change. The 'suggestion' may need to tweaked since this if the first time I used that.

Also, for the clang formatting, if you look in the README.pre-commit.md it explains how to set up the pre-commit system so your code is auto formatted to for commits.

// Open the file in binary mode
std::ofstream outfile(filepath, std::ios::out | std::ios::binary);

if (!outfile) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I would throw an exception. The DBG(...); output is fine, so do that first. Then,

Suggested change
if (!outfile) {
if (!outfile) {
// errno captures the specific OS error that occurred during the open attempt
throw std::system_error(errno, std::generic_category(), "Failed to open " + filepath);
}

You may have to add a new header like

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