LCOV - code coverage report
Current view: top level - ffb - FFBConfig.h (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 100.0 % 15 15
Test Date: 2026-03-20 13:12:51 Functions: 100.0 % 3 3
Branches: 83.3 % 12 10

             Branch data     Line data    Source code
       1                 :             : #ifndef FFBCONFIG_H
       2                 :             : #define FFBCONFIG_H
       3                 :             : 
       4                 :             : #include <algorithm>
       5                 :             : #include <cmath>
       6                 :             : 
       7                 :             : struct GeneralConfig {
       8                 :             :     float gain = 1.0f;
       9                 :             :     float min_force = 0.0f;
      10                 :             :     float wheelbase_max_nm = 15.0f;
      11                 :             :     float target_rim_nm = 10.0f;
      12                 :             :     bool dynamic_normalization_enabled = false;
      13                 :             :     bool auto_load_normalization_enabled = false;
      14                 :             : 
      15                 :         462 :     bool Equals(const GeneralConfig& o) const {
      16                 :         462 :         const float eps = 0.0001f;
      17                 :        1835 :         auto is_near = [eps](float a, float b) { return std::abs(a - b) < eps; };
      18         [ +  + ]:         922 :         return is_near(gain, o.gain) &&
      19         [ +  + ]:         919 :                is_near(min_force, o.min_force) &&
      20         [ +  + ]:         913 :                is_near(wheelbase_max_nm, o.wheelbase_max_nm) &&
      21                 :         454 :                is_near(target_rim_nm, o.target_rim_nm) &&
      22   [ +  +  +  - ]:        1375 :                dynamic_normalization_enabled == o.dynamic_normalization_enabled &&
      23         [ +  - ]:         915 :                auto_load_normalization_enabled == o.auto_load_normalization_enabled;
      24                 :             :     }
      25                 :             : 
      26                 :        1059 :     void Validate() {
      27                 :        1059 :         gain = (std::max)(0.0f, gain);
      28                 :        1059 :         wheelbase_max_nm = (std::max)(1.0f, wheelbase_max_nm);
      29                 :        1059 :         target_rim_nm = (std::max)(1.0f, target_rim_nm);
      30                 :        1059 :         min_force = (std::max)(0.0f, min_force);
      31                 :        1059 :     }
      32                 :             : };
      33                 :             : 
      34                 :             : #endif // FFBCONFIG_H
        

Generated by: LCOV version 2.0-1