Skip to content

test: add regression tests for turtle-singer note execution and counting behavior#6128

Open
mahesh-09-12 wants to merge 1 commit intosugarlabs:masterfrom
mahesh-09-12:test/turtle-singer-note-execution-clean
Open

test: add regression tests for turtle-singer note execution and counting behavior#6128
mahesh-09-12 wants to merge 1 commit intosugarlabs:masterfrom
mahesh-09-12:test/turtle-singer-note-execution-clean

Conversation

@mahesh-09-12
Copy link
Contributor

Summary

This PR continues strengthening regression protection for the turtle-singer.js engine by adding focused tests for the note execution pipeline and note counting logic.

A previous PR introduced regression tests covering lifecycle and pitch execution paths (killAllVoices, numberOfNotes, processPitch).
This PR extends that work by protecting additional execution behaviors related to note scheduling and counting.

This PR replaces #6113, which was closed to clean up commit history and remove unrelated changes introduced during rebasing.

No production code changes were made.

Covered Areas

1. noteCounter()

Adds regression tests protecting the internal counting mechanism used when evaluating note blocks.

Tests verify:

  • Execution state restoration after counting
  • suppressOutput is restored correctly
  • justCounting stack integrity
  • Turtle timing state remains unchanged

2. processNote()

Adds regression tests protecting the core note execution entry point.

Tests verify:

  • BPM stack integrity during execution
  • Correct fallback behavior when the BPM stack is empty
  • Stage update is triggered after note processing

3. scalarDistance() Edge Cases

Adds coverage for important edge cases including:

  • Equal note distance
  • Reverse note ordering

Impact

  • Improves functional coverage of turtle-singer.js
  • Strengthens regression protection for note execution and counting behavior
  • Ensures timing and counting behaviors remain stable during future refactors

PR Category

  • Bug Fix
  • Feature
  • Performance
  • Tests
  • Documentation

@github-actions github-actions bot added the tests Adds or updates test coverage label Mar 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

✅ All Jest tests passed! This PR is ready to merge.

@mahesh-09-12
Copy link
Contributor Author

@subhraneel2005 this PR continues the turtle-singer regression test work with a clean branch after closing the previous attempt that had unrelated commits during rebasing.

@mahesh-09-12 mahesh-09-12 changed the title Add regression tests for note execution and counting behavior in turtle-singer test: add regression tests for turtle-singer note execution and counting behavior Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Adds or updates test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant