LCOV - code coverage report
Current view: top level - tests - location.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 16 16 100.0 %
Date: 2024-05-11 21:41:31 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 9 18 50.0 %

           Branch data     Line data    Source code
       1                 :            : #undef G_DISABLE_ASSERT
       2                 :            : 
       3                 :            : #include <shumate/shumate.h>
       4                 :            : 
       5                 :            : void
       6                 :          3 : test_location_distance (void)
       7                 :            : {
       8                 :          3 :   g_autoptr(ShumateLocation) a = SHUMATE_LOCATION (shumate_coordinate_new_full (0.0, 0.0));
       9         [ +  - ]:          6 :   g_autoptr(ShumateLocation) b = SHUMATE_LOCATION (shumate_coordinate_new_full (0.0, 0.0));
      10                 :            : 
      11         [ -  + ]:          3 :   g_assert_cmpfloat (shumate_location_distance (a, b), ==, 0.0);
      12                 :            : 
      13                 :          3 :   shumate_location_set_location (a, 1.0, 1.0);
      14   [ -  +  -  + ]:          3 :   g_assert_cmpfloat_with_epsilon (shumate_location_distance (a, b),
      15                 :            :                                   157425.537108393531, 0.001);
      16                 :            : 
      17                 :          3 :   shumate_location_set_location (a, 0.0, 180.0);
      18   [ -  +  -  + ]:          3 :   g_assert_cmpfloat_with_epsilon (shumate_location_distance (a, b),
      19                 :            :                                   20037508.342789243, 0.001);
      20                 :            : 
      21                 :          3 :   shumate_location_set_location (a, 1.0, 2.0);
      22                 :          3 :   shumate_location_set_location (b, 3.0, 4.0);
      23   [ -  +  -  +  :          3 :   g_assert_cmpfloat_with_epsilon (shumate_location_distance (a, b),
                   +  - ]
      24                 :            :                                   314755.1553654014, 0.001);
      25                 :          3 : }
      26                 :            : 
      27                 :            : int
      28                 :          3 : main (int argc, char *argv[])
      29                 :            : {
      30                 :          3 :   g_test_init (&argc, &argv, NULL);
      31                 :            : 
      32                 :          3 :   g_test_add_func ("/location/distance", test_location_distance);
      33                 :            : 
      34                 :          3 :   return g_test_run ();
      35                 :            : }
      36                 :            : 

Generated by: LCOV version 1.14