Skip to content

Add round-trip and leap-year coverage tests for DateTimeConverter (pre/post 1970)#135

Open
Rutuja-Patil-Bosch wants to merge 20 commits intoeclipse-score:mainfrom
bgsw-contrib:main
Open

Add round-trip and leap-year coverage tests for DateTimeConverter (pre/post 1970)#135
Rutuja-Patil-Bosch wants to merge 20 commits intoeclipse-score:mainfrom
bgsw-contrib:main

Conversation

@Rutuja-Patil-Bosch
Copy link
Copy Markdown
Contributor

@Rutuja-Patil-Bosch Rutuja-Patil-Bosch commented Apr 1, 2026

Summary

This PR extends unit test coverage for DateTimeConverter by adding round-trip validation and additional leap-year scenarios, especially around pre-1970 and post-1970 boundaries.

Changes

  • Added round-trip test validation:
    • epoch → DateTime → epoch consistency checks
  • Added test coverage for:
    • Pre-1970 leap year (1968)
    • Post-1970 leap year (1972)
  • Included full month/day sweeps to validate:
    • Leap day handling (Feb 29)
    • Month boundary correctness
    • Internal day-sum adjustments

Motivation

The added tests ensure correctness of:

  • Leap year handling logic
  • Edge cases around Unix epoch (1970)
  • Internal date-to-epoch conversion consistency

This improves confidence in DateTimeConverter for:

  • Historical timestamps (pre-1970)
  • Leap year transitions
  • Boundary conditions in conversion logic

Notes

  • Invalid dates are skipped during iteration
  • Focus is on ensuring no regression in conversion logic
  • No production code changes included

Test Scope

  • Covers both:
    • 'dateTimeToEpoch'
    • 'epochToDateTime'
  • Validates bidirectional consistency

Impact

  • Increased unit test coverage
  • Better validation of edge cases and leap-year logic
  • No impact on runtime behavior

Rutuja-Patil-Bosch and others added 3 commits March 24, 2026 14:04
…lse_isValidDateTimeFormat EpochToDateTime_Before1970_LeapYear_January_AdjustsDaysSum invalid_day_values invalid_month_values
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 1, 2026

The created documentation from the pull request is available at: docu-html

Comment thread score/datetime_converter/datetime_converter_test.cpp Outdated
Comment thread score/datetime_converter/datetime_converter_test.cpp Outdated
Comment thread score/datetime_converter/datetime_converter_test.cpp Outdated
Comment thread score/datetime_converter/datetime_converter_test.cpp Outdated
Comment thread score/datetime_converter/datetime_converter_test.cpp Outdated
Comment thread score/datetime_converter/datetime_converter_test.cpp Outdated
Comment thread score/datetime_converter/datetime_converter_test.cpp Outdated
Comment thread score/datetime_converter/datetime_converter_test.cpp Outdated
Comment thread score/datetime_converter/datetime_converter_test.cpp Outdated
@bgsw-contrib bgsw-contrib Bot had a problem deploying to workflow-approval April 8, 2026 00:23 Failure
@bgsw-contrib bgsw-contrib Bot had a problem deploying to workflow-approval April 8, 2026 00:23 Failure
@AlexanderLanin
Copy link
Copy Markdown
Member

@Rutuja-Patil-Bosch please avoid bot based commits. Feel free to contact me directly.

@bgsw-contrib bgsw-contrib Bot had a problem deploying to workflow-approval April 9, 2026 00:19 Failure
@bgsw-contrib bgsw-contrib Bot had a problem deploying to workflow-approval April 9, 2026 00:19 Failure
@4og 4og mentioned this pull request Apr 9, 2026
@bgsw-contrib bgsw-contrib Bot temporarily deployed to workflow-approval April 10, 2026 00:22 Inactive
@bgsw-contrib bgsw-contrib Bot temporarily deployed to workflow-approval April 10, 2026 00:22 Inactive
@bgsw-contrib bgsw-contrib Bot requested a deployment to workflow-approval April 21, 2026 00:26 Waiting
TEST_F(DateTimeConverterTest, invalid_month_values)
{
RecordProperty("Description", "Verify invalid month values are rejected.");
RecordProperty("TestType", "Negative");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@gierer Test type should be "requirements-based" or "Requirements-based test". Specification says its should be
requirements-based / interface-test/ coverage but in other baselib features test type is mentioned as "Requirements-based test".

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.

Reagrding

but in other baselib features test type is mentioned as "Requirements-based test".

Unfortunately, not all tests in baselibs repo are compliant to the specification. We're going to fix that.

Copy link
Copy Markdown
Contributor Author

@Rutuja-Patil-Bosch Rutuja-Patil-Bosch Apr 30, 2026

Choose a reason for hiding this comment

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

@4og : I'll update as per specification & update as "requirements-based"

Comment on lines +460 to +461
RecordProperty("Requirement", "DatetimeValidation");
RecordProperty("Coverage", "MonthValidation");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread score/datetime_converter/datetime_converter_test.cpp Outdated
auto datetimeConverted = score::common::epochToDateTime(epoch);
if (datetimeConverted == nullptr)
continue;
ASSERT_NE(datetimeConverted, nullptr);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this is dead code

Comment thread score/datetime_converter/datetime_converter_test.cpp Outdated
@bgsw-contrib bgsw-contrib Bot requested a deployment to workflow-approval April 23, 2026 00:29 Waiting
@bgsw-contrib bgsw-contrib Bot requested a deployment to workflow-approval April 23, 2026 00:29 Waiting
@bgsw-contrib bgsw-contrib Bot requested a deployment to workflow-approval April 24, 2026 00:28 Waiting
@bgsw-contrib bgsw-contrib Bot requested a deployment to workflow-approval April 24, 2026 00:28 Waiting
@bgsw-contrib bgsw-contrib Bot temporarily deployed to workflow-approval April 30, 2026 00:31 Inactive
@bgsw-contrib bgsw-contrib Bot temporarily deployed to workflow-approval April 30, 2026 00:31 Inactive
@bgsw-contrib bgsw-contrib Bot temporarily deployed to workflow-approval May 1, 2026 00:33 Inactive
@bgsw-contrib bgsw-contrib Bot temporarily deployed to workflow-approval May 1, 2026 00:33 Inactive
@bgsw-contrib bgsw-contrib Bot requested a review from antonkri as a code owner May 6, 2026 00:30
@bgsw-contrib bgsw-contrib Bot requested a deployment to workflow-approval May 6, 2026 00:30 Waiting
@bgsw-contrib bgsw-contrib Bot requested a deployment to workflow-approval May 6, 2026 00:30 Waiting
@bgsw-contrib bgsw-contrib Bot temporarily deployed to workflow-approval May 7, 2026 00:31 Inactive
@bgsw-contrib bgsw-contrib Bot temporarily deployed to workflow-approval May 7, 2026 00:31 Inactive
@bgsw-contrib bgsw-contrib Bot requested a deployment to workflow-approval May 8, 2026 00:31 Waiting
@bgsw-contrib bgsw-contrib Bot requested a deployment to workflow-approval May 8, 2026 00:31 Waiting
@4og
Copy link
Copy Markdown
Member

4og commented May 8, 2026

@Rutuja-Patil-Bosch, are you planning to continue with this PR?

@Rutuja-Patil-Bosch
Copy link
Copy Markdown
Contributor Author

@Rutuja-Patil-Bosch, are you planning to continue with this PR?

@4og : Will commit changes by Monday EOD.

@bgsw-contrib bgsw-contrib Bot requested a deployment to workflow-approval May 9, 2026 00:33 Waiting
@bgsw-contrib bgsw-contrib Bot requested a deployment to workflow-approval May 9, 2026 00:33 Waiting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

5 participants