SQA: Buzzer unit tests

Open
#328 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
c

Research direction

Start by locating the buzzer driver and its test location, then read test_apogee_detect.c and other examples in the Flight-Computer-Firmware test or driver _test folders. Mock HAL_TIM_PWM_Start, HAL_Delay, and other calls used by buzzer_beep and buzzer_multi_beeps, then verify each function's calls, return status, and 100% line coverage.

Written by the indexing model from the issue text.

Description

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

Dominant language
C
Stars
8
Forks
6
Avg merge
6d 15h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

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 SunDevilRocketry/Flight-Computer-Firmware

All issues in SunDevilRocketry/Flight-Computer-Firmware

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.