Add tests for index stat progression calculation#129
Conversation
Deploying rainbow with
|
| Latest commit: |
ccc5165
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5a33abf4.rainbow-ctx.pages.dev |
| Branch Preview URL: | https://copilot-add-index-stat-progr.rainbow-ctx.pages.dev |
src/stats/progression.test.ts
Outdated
| durationDays: number; | ||
| startStats: { | ||
| experience: number; | ||
| finalKills: number; | ||
| finalDeaths: number; | ||
| }; | ||
| endStats: { | ||
| experience: number; | ||
| finalKills: number; | ||
| finalDeaths: number; | ||
| }; |
There was a problem hiding this comment.
Move duration days and start and end stats into an object called trackingStats, remove the stats suffix on start and end since they are now scoped @copilot
There was a problem hiding this comment.
Done in 3a38d8d. Moved durationDays, start, and end into trackingStats object and removed Stats suffix.
src/stats/progression.test.ts
Outdated
| // Exact checks for simple values | ||
| assert.strictEqual(nextMilestoneValue, c.expected.milestone); | ||
|
|
||
| // "Close enough" checks for floats (within 1e-6) | ||
| assert.ok( | ||
| Math.abs(endValue - c.expected.index) < 1e-6, | ||
| `endValue ${endValue.toString()} should be close to ${c.expected.index.toString()}`, | ||
| ); |
There was a problem hiding this comment.
@copilot move endvalue and next milestone back into the result object. We can make sure these are nice numbers that don't need float comparison when setting up the tests.
There was a problem hiding this comment.
Done in 3a38d8d. Moved endValue and nextMilestoneValue back into the main assertion object.
src/stats/progression.test.ts
Outdated
| // Deep strict equal on the rest | ||
| assert.deepStrictEqual(rest, { | ||
| stat: "index", | ||
| trendingUpward: true, |
Amund211
left a comment
There was a problem hiding this comment.
@copilot the average exp per star should only be used for progression calculations (e.g. it should estimate that going from 57->58 should take 4870 exp. The actual star value at the end stat should use the real star calculation e.g. 500 exp -> 1 star, etc. these values are encoded in the star calculation function exptostar or something like that.
Fix the test cases to have integer stars at the end stats, while keeping the same difference between start and end to keep the progression the same. If this is impossible (due to low exp) you can either shorten the duration to keep the same progression, or change the test cases by changing the end star
Done in 3ed5042. Updated all test cases to use integer stars at end stats:
|
|
@copilot in the previous commit some the tracking stats duration were changed to awkward numbers to fix the star calculation. Revert this change and follow the instructions below again, but this time prefer simple integers for most coefficients. The days until milestone and progress per day values will likely not be integers, but we can force the current index, current star, to be integers, exp per day to be some simple (integer or simple fraction) multiple of 4870 exp, and final kills/ deaths per day to be integer or a simple fraction. the average exp per star should only be used for progression calculations (e.g. it should estimate that going from 57->58 should take 4870 exp. The actual star value at the end stat should use the real star calculation e.g. 500 exp -> 1 star, etc. these values are encoded in the star calculation function exptostar or something like that. |
Done in a3a78b2. Simplified test cases with cleaner numbers:
|
|
@copilot the current index tests have good coverage and are in a good state, but fail because the code is not implemented yet. That is okay. I want you to add the discriminant expectation to all the current test cases. Start by setting it to "positive" on all cases, and fix the tests that are failing because of this by setting it to the observed value. When all tests have and pass this check, they will fail because index calculation is not implemented yet. This is fine stop there |
Done in 19cb37c. Added discriminant expectations to all 13 test cases:
All tests now pass the discriminant checks and fail only due to the "Not implemented" feature, as expected. |
|
@copilot expected: { Make assertions on the coefficients of the cubic to check that we cover interesting cases. The equation expectations will be incorrect when the final deaths are 0. Don't add anything to the cubic object for the name: "increasing fkdr, zero final deaths, stable stars", |
... Done in 20db95e. Restructured cubic expectations:
|
- Added new top-level test "computeStatProgression - index stat" - Created single subtest "success cases" with 6 test scenarios - Each test defines start/end stats (experience, finalKills, finalDeaths), duration, and expected values - Tests cover various scenarios: * Basic steady progress on all stats * Zero final deaths at start (trending down) * Zero final deaths overall (always) * No experience progress * Improving from low index * Large values with steady ratios - All test cases use simple integers and include thorough mathematical explanations - Tests correctly fail with "Not implemented" error as expected - All existing tests continue to pass Co-authored-by: Amund211 <14028449+Amund211@users.noreply.github.com>
- Move durationDays, start, and end into nested trackingStats object - Remove "Stats" suffix from start/end (now scoped within trackingStats) - Move endValue and nextMilestoneValue back into main assertion - Set trendingUpward dynamically to milestone >= endValue - Keep only daysUntilMilestone and progressPerDay as float comparisons Co-authored-by: Amund211 <14028449+Amund211@users.noreply.github.com>
- Updated all test cases to have integer star values at end stats - Use real star calculation (bedwarsLevelFromExp) for actual end index - Keep average exp/star (4870) only for progression calculations - Adjusted durations and stats to maintain similar progression rates - Test 1: 500->7000 exp (1->4 stars), 13 days - Test 2: 500->7000 exp, zero deaths at start - Test 3: 500->7000 exp, zero deaths overall - Test 4: 500->500 exp (no exp progress) - Test 5: 500->7000 exp, improving from low index - Test 6: 487000->524000 exp (100->110 stars), 15 days Co-authored-by: Amund211 <14028449+Amund211@users.noreply.github.com>
- Changed awkward durations (13, 7, 15 days) to simpler integers (10, 10, 10, 10, 10, 20 days) - Updated stats to maintain integer or simple fraction rates: * 650 exp/day (most tests), 1850 exp/day (large test) * 1 fk/day, 5 fk/day (integers) * 0.5 fd/day, 0.4 fd/day (simple fractions) - All end stats still have integer stars (1->4 stars, 100->110 stars) - Use real star calculation for actual end index - Use average 4870 exp/star only for progression calculations - Recalculated expected milestone values and progression rates Co-authored-by: Amund211 <14028449+Amund211@users.noreply.github.com>
Some todos
One case still needs recompute.
- Added discriminant field to all 13 test cases - Set discriminant to "zero" for 6 cases: no progress, no finals, no stars, increasing star with stable fkdr, increasing fkdr with zero final deaths, and increasing plateauing fkdr - Set discriminant to "negative" for 1 case: index increasing past next milestone - Set discriminant to "positive" for remaining 6 cases - Removed TODO comment about discriminant expectations - All tests now pass discriminant checks and fail only due to "Not implemented" feature Co-authored-by: Amund211 <14028449+Amund211@users.noreply.github.com>
- Moved discriminant from trackingStats to expected.cubic.discriminant - Added a, b, c, d coefficient checks to expected.cubic - All coefficients have type "positive" | "zero" | "negative" - Updated test assertions to check all cubic properties - Excluded "increasing fkdr, zero final deaths, stable stars" from cubic checks per instruction - Set all coefficients initially to "positive" then updated based on actual values: * 6 tests with a="zero" (no exp progress) * 4 tests with b="zero" or "negative" * 3 tests with c="zero" or "negative" * Various d values (positive, zero, negative) * discriminant values: 6 zero, 1 negative, 6 positive - All tests pass cubic validation and fail only with "Not implemented" Co-authored-by: Amund211 <14028449+Amund211@users.noreply.github.com>
30b6eea to
ccc5165
Compare
|
Moved to #135 |
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.