From f6b1ac2af257574fb0e81f089020435dbb43204f Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 11 Oct 2025 13:29:22 +0100 Subject: [PATCH] Add sector status parameter to read sector functions in tests --- tests/create_image.cpp | 15 +++++--- tests/open_image.cpp | 80 +++++++++++++++++++++++++----------------- 2 files changed, 58 insertions(+), 37 deletions(-) diff --git a/tests/create_image.cpp b/tests/create_image.cpp index 3188796..3472f01 100644 --- a/tests/create_image.cpp +++ b/tests/create_image.cpp @@ -118,8 +118,9 @@ TEST_F(CreateImageFixture, create_image_uncompresed_duplicated) { uint8_t sector_buffer[512]; uint32_t length = sizeof(sector_buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, sector_buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, sector_buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 512U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, sector_buffer, 512); @@ -213,8 +214,9 @@ TEST_F(CreateImageFixture, create_image_uncompresed_deduplicated) { uint8_t sector_buffer[512]; uint32_t length = sizeof(sector_buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, sector_buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, sector_buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 512U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, sector_buffer, 512); @@ -308,8 +310,9 @@ TEST_F(CreateImageFixture, create_image_compresed_duplicated) { uint8_t sector_buffer[512]; uint32_t length = sizeof(sector_buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, sector_buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, sector_buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 512U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, sector_buffer, 512); @@ -403,8 +406,9 @@ TEST_F(CreateImageFixture, create_image_compresed_deduplicated) { uint8_t sector_buffer[512]; uint32_t length = sizeof(sector_buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, sector_buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, sector_buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 512U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, sector_buffer, 512); @@ -498,8 +502,9 @@ TEST_F(CreateImageFixture, create_image_table_shift_9) { uint8_t sector_buffer[512]; uint32_t length = sizeof(sector_buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, sector_buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, sector_buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 512U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, sector_buffer, 512); diff --git a/tests/open_image.cpp b/tests/open_image.cpp index 1e085ad..eac512c 100644 --- a/tests/open_image.cpp +++ b/tests/open_image.cpp @@ -80,9 +80,10 @@ TEST_F(OpenImageFixture, open_mf2hd_v1) for(int i = 0; i < 2880; i++) { uint8_t buffer[512]; - uint32_t length = sizeof(buffer); + uint32_t length = sizeof(buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 512U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, buffer, 512); @@ -138,9 +139,10 @@ TEST_F(OpenImageFixture, open_mf2hd_v2) for(int i = 0; i < 2880; i++) { uint8_t buffer[512]; - uint32_t length = sizeof(buffer); + uint32_t length = sizeof(buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 512U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, buffer, 512); @@ -196,9 +198,10 @@ TEST_F(OpenImageFixture, open_floptical_v1) for(int i = 0; i < 40662; i++) { uint8_t buffer[512]; - uint32_t length = sizeof(buffer); + uint32_t length = sizeof(buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 512U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, buffer, 512); @@ -254,9 +257,10 @@ TEST_F(OpenImageFixture, open_floptical_v2) for(int i = 0; i < 40662; i++) { uint8_t buffer[512]; - uint32_t length = sizeof(buffer); + uint32_t length = sizeof(buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 512U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, buffer, 512); @@ -312,9 +316,10 @@ TEST_F(OpenImageFixture, open_gigamo_v1) for(int i = 0; i < 605846; i++) { uint8_t buffer[2048]; - uint32_t length = sizeof(buffer); + uint32_t length = sizeof(buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 2048U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, buffer, 2048); @@ -370,9 +375,10 @@ TEST_F(OpenImageFixture, open_gigamo_v2) for(int i = 0; i < 605846; i++) { uint8_t buffer[2048]; - uint32_t length = sizeof(buffer); + uint32_t length = sizeof(buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 2048U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, buffer, 2048); @@ -428,9 +434,10 @@ TEST_F(OpenImageFixture, open_hifd_v1) for(int i = 0; i < 393380; i++) { uint8_t buffer[512]; - uint32_t length = sizeof(buffer); + uint32_t length = sizeof(buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 512U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, buffer, 512); @@ -486,9 +493,10 @@ TEST_F(OpenImageFixture, open_hifd_v2) for(int i = 0; i < 393380; i++) { uint8_t buffer[512]; - uint32_t length = sizeof(buffer); + uint32_t length = sizeof(buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 512U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, buffer, 512); @@ -544,9 +552,10 @@ TEST_F(OpenImageFixture, open_mo540_v1) for(int i = 0; i < 1041500; i++) { uint8_t buffer[512]; - uint32_t length = sizeof(buffer); + uint32_t length = sizeof(buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 512U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, buffer, 512); @@ -602,9 +611,10 @@ TEST_F(OpenImageFixture, open_mo540_v2) for(int i = 0; i < 1041500; i++) { uint8_t buffer[512]; - uint32_t length = sizeof(buffer); + uint32_t length = sizeof(buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 512U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, buffer, 512); @@ -660,9 +670,10 @@ TEST_F(OpenImageFixture, open_mo640_v1) for(int i = 0; i < 310352; i++) { uint8_t buffer[2048]; - uint32_t length = sizeof(buffer); + uint32_t length = sizeof(buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 2048U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, buffer, 2048); @@ -718,9 +729,10 @@ TEST_F(OpenImageFixture, open_mo640_v2) for(int i = 0; i < 310352; i++) { uint8_t buffer[2048]; - uint32_t length = sizeof(buffer); + uint32_t length = sizeof(buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length); + const int32_t read_result = aaruf_read_sector(context, i, false, buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 2048U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, buffer, 2048); @@ -777,9 +789,10 @@ TEST_F(OpenImageFixture, open_cdmode1_v1) for(int i = 0; i < 9120; i++) { uint8_t buffer[2352]; - uint32_t length = sizeof(buffer); + uint32_t length = sizeof(buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector_long(context, i, false, buffer, &length); + const int32_t read_result = aaruf_read_sector_long(context, i, false, buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 2352U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, buffer, 2352); @@ -838,9 +851,10 @@ TEST_F(OpenImageFixture, open_cdmode1_v2) for(int i = 0; i < 9120; i++) { uint8_t buffer[2352]; - uint32_t length = sizeof(buffer); + uint32_t length = sizeof(buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector_long(context, i, false, buffer, &length); + const int32_t read_result = aaruf_read_sector_long(context, i, false, buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 2352U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, buffer, 2352); @@ -899,9 +913,10 @@ TEST_F(OpenImageFixture, open_cdmode2_v1) for(int i = 0; i < 9120; i++) { uint8_t buffer[2352]; - uint32_t length = sizeof(buffer); + uint32_t length = sizeof(buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector_long(context, i, false, buffer, &length); + const int32_t read_result = aaruf_read_sector_long(context, i, false, buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 2352U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, buffer, 2352); @@ -960,9 +975,10 @@ TEST_F(OpenImageFixture, open_cdmode2_v2) for(int i = 0; i < 9120; i++) { uint8_t buffer[2352]; - uint32_t length = sizeof(buffer); + uint32_t length = sizeof(buffer); + uint8_t sector_status = 0; - const int32_t read_result = aaruf_read_sector_long(context, i, false, buffer, &length); + const int32_t read_result = aaruf_read_sector_long(context, i, false, buffer, &length, §or_status); EXPECT_EQ(read_result, AARUF_STATUS_OK) << "Failed to read sector " << i; EXPECT_EQ(length, 2352U) << "Unexpected length for sector " << i; aaruf_crc64_update(ctx, buffer, 2352);