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