feat: updated readme

This commit is contained in:
unai_71 2026-03-10 16:33:08 +00:00
parent 6e1cdec81f
commit f07bec25f8

View File

@ -8,11 +8,16 @@ A Test-Driven Development (TDD) workflow was followed throughout the project. Ev
## SysfsRead class
- Will convert the contents of a file and output an enum class
- 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
`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:
| 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.