feat: updated readme
This commit is contained in:
parent
6e1cdec81f
commit
f07bec25f8
19
README.md
19
README.md
@ -8,11 +8,16 @@ A Test-Driven Development (TDD) workflow was followed throughout the project. Ev
|
|||||||
|
|
||||||
## SysfsRead class
|
## SysfsRead class
|
||||||
|
|
||||||
- Will convert the contents of a file and output an enum class
|
`SysfsReader` ([include/SysfsRead.hpp](include/SysfsRead.hpp), [src/core/SysfsRead.cxx](src/core/SysfsRead.cxx)) is the lowest-level component. It opens a sysfs-like file and translates its raw text content into a `SysfsStatus` enum:
|
||||||
- Reads a sysfs-like file
|
|
||||||
- If the file is missing, the reader will output Unreachable
|
|
||||||
- If the file contains only a "1" the reader will output Enabled
|
|
||||||
- If the file contains "error: temp too high", the reader will output ErrorTempTooHigh
|
|
||||||
- if the file contains any other value the reader will output UnexpectedValue
|
|
||||||
- if the file is empty: it will output Empty
|
|
||||||
|
|
||||||
|
| File content | Status |
|
||||||
|
|--------------------------|---------------------|
|
||||||
|
| `"1"` | `Enabled` |
|
||||||
|
| `"error: temp too high"` | `ErrorTempTooHigh` |
|
||||||
|
| empty / whitespace-only | `Empty` |
|
||||||
|
| file missing | `Unreachable` |
|
||||||
|
| anything else | `UnexpectedValue` |
|
||||||
|
|
||||||
|
The reader never throws on I/O errors; every outcome is expressed through the enum so callers can react without exception handling. A helper `trim_in_place` strips trailing whitespace and newlines before comparison.
|
||||||
|
|
||||||
|
**Tests:** [tests/test_sysfs_read.cxx](tests/test_sysfs_read.cxx) — covers all five status branches by writing controlled content to a temporary file.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user