Skip to content

Add splitInteger unit tests - #1119

Open
khchan246810 wants to merge 1 commit into
mate-academy:mainfrom
khchan246810:master
Open

khchan246810 wants to merge 1 commit into
mate-academy:mainfrom
khchan246810:master

Conversation

@khchan246810

Copy link
Copy Markdown

This is my answer.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

The test file correctly validates the splitInteger function according to all stated requirements. The test expectation for splitInteger(3, 5) as [0, 0, 1, 1, 1] is correct because the requirements explicitly state the output must be sorted in ascending order, have length equal to numberOfParts, sum to value, and have max-min difference ≤ 1. The ascending order requirement IS validated by this test case since [0, 0, 1, 1, 1] is not trivially sorted in the same way as [1, 1, 1, 0, 0] would be. If the student's implementation produces [1, 1, 1, 0, 0], that indicates a bug in the implementation code that must be fixed to meet the requirements, not an issue with the test expectations. All test cases cover the specified requirements: equal divisions (6, 2), single-part returns (8, 1), unequal distributions (17, 4 and 32, 6), and the edge case where value is less than numberOfParts (3, 5).


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example ↩

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