LCOV - code coverage report
Current view: top level - build-gcc/src - version.c (source / functions) Hit Total Coverage
Test: passgen-test.info Lines: 13 13 100.0 %
Date: 2024-11-29 06:05:05 Functions: 3 3 100.0 %

          Line data    Source code
       1             : #include <passgen/config.h>
       2             : #include <passgen/version.h>
       3             : #include <stddef.h>
       4             : 
       5           6 : passgen_version passgen_version_get() {
       6           6 :     return (passgen_version) {
       7             :         .major = 1,
       8             :         .minor = 0,
       9             :         .patch = 0,
      10             :         .build = "-",
      11             :         .prerelease = NULL,
      12             :     };
      13             : }
      14             : 
      15           4 : bool passgen_version_compatible(passgen_version version) {
      16             :     // get current version
      17           4 :     passgen_version current = passgen_version_get();
      18             : 
      19             :     // major version must match exactly
      20           4 :     if(current.major != version.major) {
      21           1 :         return false;
      22             :     }
      23             : 
      24             :     // minor version must not be smaller
      25           3 :     if(current.minor < version.minor) {
      26           1 :         return false;
      27             :     }
      28             : 
      29             :     // if minor version is same, patch must not be smaller
      30           2 :     if(current.minor == version.minor && current.patch < version.patch) {
      31           1 :         return false;
      32             :     }
      33             : 
      34           1 :     return true;
      35             : }
      36             : 
      37           1 : bool passgen_is_debug(void) {
      38             : #ifdef PASSGEN_DEBUG
      39           1 :     return true;
      40             : #else
      41             :     return false;
      42             : #endif
      43             : }

Generated by: LCOV version 1.14