Skip to content

Conversation

@pjbRPF
Copy link
Contributor

@pjbRPF pjbRPF commented Nov 26, 2025

  • test_speaker_default_values: Tests basic Speaker initialization with default freq (440Hz) and volume (0)
  • test_speaker_alt_values: Tests custom initial_freq and initial_volume parameters with delta tolerance for PWM frequency variations
  • test_speaker_note_conversion: Tests _to_freq() method for string notes, MIDI notes, and direct frequency values
  • test_speaker_play_single_note: Tests playing a single note and verifies volume is 0 after playback
  • test_speaker_play_note_list: Tests playing a sequence of notes with durations
  • test_distance_sensor_basic: Tests DistanceSensor initialization with default max_distance (1.0m)
  • test_distance_sensor_custom_max_distance: Tests custom max_distance parameter

Speaker tests use pins 15-19, DistanceSensor tests use pins 22-25 to avoid conflicts.
Uses assertAlmostEqual with delta=10 for PWM frequency assertions to account for hardware limitations.

- test_speaker_default_values: Tests basic Speaker initialization with default freq (440Hz) and volume (0)
- test_speaker_alt_values: Tests custom initial_freq and initial_volume parameters with delta tolerance for PWM frequency variations
- test_speaker_note_conversion: Tests _to_freq() method for string notes, MIDI notes, and direct frequency values
- test_speaker_play_single_note: Tests playing a single note and verifies volume is 0 after playback
- test_speaker_play_note_list: Tests playing a sequence of notes with durations
- test_distance_sensor_basic: Tests DistanceSensor initialization with default max_distance (1.0m)
- test_distance_sensor_custom_max_distance: Tests custom max_distance parameter

Speaker tests use pins 15-19, DistanceSensor tests use pins 22-25 to avoid conflicts.
Uses assertAlmostEqual with delta=10 for PWM frequency assertions to account for hardware limitations.
@pjbRPF pjbRPF requested a review from MarcScott as a code owner November 26, 2025 12:25
@pjbRPF pjbRPF self-assigned this Nov 26, 2025
@pjbRPF
Copy link
Contributor Author

pjbRPF commented Nov 26, 2025

Fixes #10

@pjbRPF pjbRPF linked an issue Nov 26, 2025 that may be closed by this pull request
@pjbRPF pjbRPF changed the base branch from main to dev November 28, 2025 11:24
@pjbRPF pjbRPF merged commit 96610c9 into dev Nov 28, 2025
@pjbRPF pjbRPF deleted the patch/add_speaker_and_distance_sensor_tests branch November 28, 2025 11:26
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.

Create automated test process

3 participants