Write Unit Tests for RGBLEDHelper #260
Labels
enhancement
New feature or request
hacktoberfest
Open for Hacktoberfest contributions. Please follow contribution guidelines and submit meaningful PR
unit-test
To ensure individual components or functions work as intended.
Description:
Write unit tests for the RGBLEDHelper class to ensure proper functionality of all its methods, including color setting, frequency handling, and turning the LED on/off. Use mocks for the Pwm components to simulate hardware interaction.
Tasks:
Test Initialization:
Verify that RGBLEDHelper correctly initializes Pwm instances for red, green, and blue.
Test setColor Methods:
Test setColor(int[] colors) to ensure it sets the RGB values with default frequency (200 Hz).
Test setColor(int[] colors, int[] frequency) to verify RGB values and corresponding frequencies are set properly.
Test setColorHex Methods:
Test setColorHex(String hex) for correct RGB values from hex and default frequency.
Test setColorHex(String hex, int[] frequency) for correct RGB values and frequencies.
Test Individual Color Setters:
Write tests for setRed, setGreen, and setBlue to validate both color value and frequency setting.
Test ledOff and ledOn:
Ensure ledOff() turns off all RGB components.
Ensure ledOn() sets all RGB values to 100 with default frequency.
Acceptance Criteria:
The text was updated successfully, but these errors were encountered: