24 lines
1.5 KiB
Markdown
24 lines
1.5 KiB
Markdown
# azkoyen_technical_test
|
|
|
|
Azkoyen technical test implementation. Implemented (mostly) on standard c++ 17 framework, but with Qt wherever was necessary.
|
|
|
|
## Development approach
|
|
|
|
A Test-Driven Development (TDD) workflow was followed throughout the project. Every component — from the lowest-level file reader to the GUI window — has a corresponding Google Test suite that was written before (or alongside) the production code. This ensures each module behaves correctly in isolation and makes regressions immediately visible.
|
|
|
|
## SysfsRead 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:
|
|
|
|
| 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.
|