Skip to content

test: Correct Age.toString test - #476

Merged
halcwb merged 1 commit into
informedica:masterfrom
ploeh:correct-age-tostring-test
Aug 20, 2026
Merged

test: Correct Age.toString test#476
halcwb merged 1 commit into
informedica:masterfrom
ploeh:correct-age-tostring-test

Conversation

@ploeh

@ploeh ploeh commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Overview

Correct existing test of Patient.Age.toString.

Further information

It dawned on me that since I wish to change how Age is represented (re #469), it doesn't work if test cases are coupled to the current representation.

This pull request changes the test cases for Patient.Age.toString so that they don't directly make use of the Age type, but rather uses int to represent the total number of days of a patient age. This should enable us to refactor Age while keeping the test cases.

Divergence from plan

The pull request is unfortunately much larger than 200 lines of code, which is caused by 100 FsCheck-generated test cases that are formatted in a vertically-biased way (re #465).

Verification

dotnet run servertests pass.

Author checklist

Note

An issue and agreed implementation plan are necessary unless either fewer than 25 lines have been changed or only documentation has been changed.

I confirm that these changes:

  • Follow the process described in CONTRIBUTING.md.
  • Make the changes proposed in the linked issue (if applicable): n/a
  • Follow the approach documented in the linked implementation plan (if applicable): n/a
  • Are no more than 200 lines of changed code, ideally 25-100.
  • Are not more complex than necessary.
  • Cannot easily be split in a way that would make reviewing them significantly easier.
  • Follow the guidelines specified in DEVELOPMENT.md.
  • Have been thoroughly tested.
  • Don't introduce new security vulnerabilities.
  • Follow the AI/LLM Usage Policy — LLMs were not given direct write access to .fs source files (except client-side UI code).

AI/Vibe Coding Disclosure

  • Some or all code in this PR is vibe coded (substantially AI-generated). If checked, describe below which parts were AI-generated, which tool was used, and how the code was verified.

I confirm that I have:

  • Added appropriate automated tests.
  • Updated documentation appropriately.
  • Added comments that highlight important changes and add justification, where necessary. (Create the PR as a draft first, add your comments, then mark as ready for review.)

Reviewer checklist

I confirm that:

  • I am confident that the changes work.
  • The changed code meets our guidelines and standards.
  • The new code is not more complex than necessary.
  • I have clearly labelled suggestions as blocking, required but not blocking, or optional (see CONTRIBUTING.md).

It dawned on me that since I wish to change how `Age` is represented, it
doesn't work if test cases are coupled to the current representation.
@ploeh
ploeh requested a review from halcwb August 20, 2026 06:57
@greptile-apps

greptile-apps Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR decouples the Patient.Age.toString test fixtures from the current internal Age representation.

  • Replaces explicit Age records in generated fixtures with total day counts.
  • Reconstructs each age through Patient.Age.fromDays when executing the test.
  • Updates the fixture-generation script to emit day counts.

Confidence Score: 5/5

The PR appears safe to merge, with no actionable regressions identified.

The revised fixtures reconstruct the same fromDays-generated age states covered previously, and the expected formatter outputs remain committed literals rather than being calculated during test execution.

Important Files Changed

Filename Overview
tests/Informedica.GenPRES.Shared.Tests/AgeTests.fs Converts formatter fixtures to day-based inputs while preserving the tested age domain and committed expected outputs.
tests/Informedica.GenPRES.Shared.Tests/Scripts/AgeToStringOracle.fsx Updates the fixture generator to retain raw day counts rather than serialized Age records.

Reviews (1): Last reviewed commit: "test: Correct Age.toString test" | Re-trigger Greptile

@halcwb
halcwb merged commit aeb3bcc into informedica:master Aug 20, 2026
12 checks passed
@ploeh
ploeh deleted the correct-age-tostring-test branch August 20, 2026 07:15
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