Skip to content

test: add regression tests for change() in CoinChange.js (R50-T031) - #69

Open
nishadaniket174 wants to merge 1 commit into
S-AI-Projects:masterfrom
nishadaniket174:student/e26b07f0789/R50-T031
Open

nishadaniket174 wants to merge 1 commit into
S-AI-Projects:masterfrom
nishadaniket174:student/e26b07f0789/R50-T031

Conversation

@nishadaniket174

@nishadaniket174 nishadaniket174 commented Nov 12, 2026 •

Copy link
Copy Markdown

Description

This PR adds regression tests for the change() function in Dynamic-Programming/CoinChange.js as part of Task R50-T031.

The main goal is to make sure the function continues to return the correct number of ways to make a given amount using the available coin denominations.

What has been tested?

Three different scenarios have been covered:

1. Smallest valid input

coins = []
amount = 0
expected = 1

When the target amount is zero, there is exactly one possible way to make it: by choosing no coins.

2. Normal input

coins = [1, 2, 5]
amount = 5
expected = 4

There are four ways to make the amount 5:

  • 1 + 1 + 1 + 1 + 1
  • 1 + 1 + 1 + 2
  • 1 + 2 + 2
  • 5

The function should return 4.

3. Repeated coin values and an impossible amount

coins = [2, 2]
amount = 1
expected = 0

Since neither coin can be used to make the amount 1, the function should return 0.

Additional checks

  • Checked that the original coins array is not modified when the function is called.
  • Added clear expected results so that any incorrect output can be identified easily.
  • Reviewed the implementation to understand the conditions and behavior being tested.

Running the tests

The task's focused test runner can be executed using:

python3 work/R50-T031/check.py

Execution results and environment details are recorded in:

work/R50-T031/execution_log_R50_T031.txt

Task Information

These tests are intended to protect the existing behavior of change() and make it easier to catch unexpected changes in the future.

Closes #31

@nishadaniket174
nishadaniket174 force-pushed the student/e26b07f0789/R50-T031 branch from e0546b6 to e8031ba Compare November 21, 2026 13:21
@nishadaniket174

Copy link
Copy Markdown
Author

requesting instructor review.
PR: #69

@nishadaniket174 nishadaniket174 changed the title Add regression tests for change() in CoinChange.js (Task R50-T031) test: add regression tests for change() in CoinChange.js (R50-T031) Nov 21, 2026
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.

ANIKET KUMAR NISHAD — R50-T031: Lock down the contract of change (CoinChange.js) [Dynamic-Programming/CoinChange.js]

1 participant