Pin the instances in Reduce_Snapshot_Tests so a default-instance change can't break it

Open Beginner friendly
#960 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
testing

Research direction

The test to change is redux-tests/Endpoints/Reduce_Snapshot_Tests.cs, which currently builds its input from each problem's default instance. Read it first to see how the inputs and snapshots are wired, and check the #690 map-back behaviour it guards for /reduce and /info. Replace the default lookup with fixed instances (for example via InlineData) and keep the snapshot assertions. Done means the test still passes after you change a problem's default instance, and it still fails if the map-back change leaks into /reduce or /info.

Written by the indexing model from the issue text.

Description

good first issue

The reduction snapshot test (redux-tests/Endpoints/Reduce_Snapshot_Tests.cs, added in #749) builds its input from each problem's current default instance. So whenever a default changes, the snapshots no longer match and the test fails, even though the reduction code is fine. This happened when #957 changed the 3SAT and Vertex Cover defaults, and #959 had to refresh the snapshots.

Fix: give the test fixed instances, for example in InlineData, instead of reading the default. It keeps guarding what it was written for: the #690 map-back change must not leak into /reduce and /info. Changing a default then no longer breaks it.

Part of #938.

Dominant language
C#
Stars
9
Forks
34
Avg merge
3d 2h
Merged PRs (30d)
41

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ReduxISU/Redux

All issues in ReduxISU/Redux

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.