Docs: fix typos (#2016)
Fixed typos in UnitTests.md Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
c511c67e71
commit
4f3ef83c77
@ -13,7 +13,7 @@ Running existing unit tests is useful to ensure that the new code doesn't introd
|
|||||||
In order to run the unit tests, follow these steps:
|
In order to run the unit tests, follow these steps:
|
||||||
1. Compile the firmware with the tests enabled: `./fbt FIRMWARE_APP_SET=unit_tests`.
|
1. Compile the firmware with the tests enabled: `./fbt FIRMWARE_APP_SET=unit_tests`.
|
||||||
2. Flash the firmware using your preferred method.
|
2. Flash the firmware using your preferred method.
|
||||||
3. Copy the [assets/unit_tests](assets/unit_tests) folder to the root your Flipper Zero's SD card.
|
3. Copy the [assets/unit_tests](assets/unit_tests) folder to the root of your Flipper Zero's SD card.
|
||||||
4. Launch the CLI session and run the `unit_tests` command.
|
4. Launch the CLI session and run the `unit_tests` command.
|
||||||
|
|
||||||
**NOTE:** To run a particular test (and skip all others), specify its name as the command argument.
|
**NOTE:** To run a particular test (and skip all others), specify its name as the command argument.
|
||||||
@ -22,9 +22,9 @@ See [test_index.c](applications/debug/unit_tests/test_index.c) for the complete
|
|||||||
## Adding unit tests
|
## Adding unit tests
|
||||||
### General
|
### General
|
||||||
#### Entry point
|
#### Entry point
|
||||||
The common entry point for all tests it the [unit_tests](applications/debug/unit_tests) application. Test-specific code is placed into an arbitrarily named subdirectory and is then called from the [test_index.c](applications/debug/unit_tests/test_index.c) source file.
|
The common entry point for all tests is the [unit_tests](applications/debug/unit_tests) application. Test-specific code is placed into an arbitrarily named subdirectory and is then called from the [test_index.c](applications/debug/unit_tests/test_index.c) source file.
|
||||||
#### Test assets
|
#### Test assets
|
||||||
Some unit tests require external data in order to function. These files (commonly called assets) reside in the [assets/unit_tests](/assets/unit_tests) directory in their respective subdirectories. Asset files can be of any type (plain text, FlipperFormat(FFF), binary etc).
|
Some unit tests require external data in order to function. These files (commonly called assets) reside in the [assets/unit_tests](/assets/unit_tests) directory in their respective subdirectories. Asset files can be of any type (plain text, FlipperFormat(FFF), binary, etc).
|
||||||
### Application-specific
|
### Application-specific
|
||||||
#### Infrared
|
#### Infrared
|
||||||
Each infrared protocol has a corresponding set of unit tests, so it makes sense to implement one when adding support for a new protocol.
|
Each infrared protocol has a corresponding set of unit tests, so it makes sense to implement one when adding support for a new protocol.
|
||||||
@ -37,8 +37,8 @@ In order to add unit tests for your protocol, follow these steps:
|
|||||||
##### Test data format
|
##### Test data format
|
||||||
Each unit test has 3 sections:
|
Each unit test has 3 sections:
|
||||||
1. `decoder` - takes in raw signal and outputs decoded messages.
|
1. `decoder` - takes in raw signal and outputs decoded messages.
|
||||||
2. `encoder` - takes in decoded messages and outputs raw signal.
|
2. `encoder` - takes in decoded messages and outputs a raw signal.
|
||||||
3. `encoder_decoder` - takes in decoded messages, turns them into raw signal and then decodes again.
|
3. `encoder_decoder` - takes in decoded messages, turns them into a raw signal, and then decodes again.
|
||||||
|
|
||||||
Infrared test asset files have an `.irtest` extension and are regular `.ir` files with a few additions.
|
Infrared test asset files have an `.irtest` extension and are regular `.ir` files with a few additions.
|
||||||
Decoder input data has signal names `decoder_input_N`, where N is a test sequence number. Expected data goes under the name `decoder_expected_N`. When testing the encoder these two are switched.
|
Decoder input data has signal names `decoder_input_N`, where N is a test sequence number. Expected data goes under the name `decoder_expected_N`. When testing the encoder these two are switched.
|
||||||
@ -46,4 +46,4 @@ Decoder input data has signal names `decoder_input_N`, where N is a test sequenc
|
|||||||
Decoded data is represented in arrays (since a single raw signal may decode to several messages). If there is only one signal, then it has to be an array of size 1. Use the existing files as syntax examples.
|
Decoded data is represented in arrays (since a single raw signal may decode to several messages). If there is only one signal, then it has to be an array of size 1. Use the existing files as syntax examples.
|
||||||
|
|
||||||
##### Getting raw signals
|
##### Getting raw signals
|
||||||
Recording raw IR signals is possible using Flipper Zero. Launch the CLI session, run `ir rx raw`, then point the remote towards Flipper's receiver and send the signals. The raw signal data will be printed to the console in a convenient format.
|
Recording raw IR signals are possible using the Flipper Zero. Launch the CLI session, run `ir rx raw`, then point the remote towards Flipper's receiver and send the signals. The raw signal data will be printed to the console in a convenient format.
|
||||||
|
Loading…
Reference in New Issue
Block a user