SQA: Buzzer unit tests

Aperta
#56 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@DanielB-2 ci sta già lavorando.

Dal 29/9/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

enhancement good first issue

Version: 2.7.0/2.8.0

Describe the feature you'd like
Write unit tests for the buzzer driver. This should test both buzzer_beep and buzzer_multi_beeps and achieve 100% line coverage for the two functions.

You'll need to make mock functions for the HAL calls like HAL_TIM_PWM_Start and HAL_Delay; see other tests for examples of how do this. You shouldn't get any linker errors after mocking all the function calls inside the functions you're testing, Then, call each function separately and use test asserts to check that the function performed as expected. For example, in the mock function for the HAL PWM start and stop, you can set a flag that confirms that the function was called. Then, check to make sure each flag was set after the test. Another simple test is to check to make sure the function returns what you expect (returns the expected BUZZ_STATUS)

You don't need to write a test for buzzer_num_beeps since that function is unused. If you want the coverage report to show 100% coverage, you can remove it.

Describe alternatives you've considered
N/A

Additional context
You can find other examples of unit tests in the Flight-Computer-Firmware test folder or in the driver _test folder. test_flight.c is a good example of a large, expansive test, but this task won't be nearly as big. test_apogee_detect.c is a good example of a simpler test.

Points of Contact
Firmware Lead: @NArmistead
sqa goat: @ETSells

Lingua principale
C
Stelle
2
Fork
0
Merge medio
6g 17h
PR unite (30g)
3

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SunDevilRocketry/driver

Tutte le issue di SunDevilRocketry/driver

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.