Host C Specs


Directory: src/c/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 12 / 0 / 12
Functions: 100.0% 2 / 0 / 2
Branches: 78.6% 11 / 0 / 14

core/wire/music_track.c
Line Branch Exec Source
1 /**
2 * @file music_track.c
3 * @brief Taking in the track the phone sent.
4 *
5 * @ingroup lib_core
6 */
7 #include "wire/music_track.h"
8
9 #include "text/cstring_fit.h"
10
11 13 bool music_track_set(MusicTrack *track, const char *title, const char *artist, bool playing)
12 {
13
1/2
✓ Branch 2 → 3 taken 13 times.
✗ Branch 2 → 4 not taken.
13 const char *new_title = title ? title : "";
14
2/2
✓ Branch 5 → 6 taken 12 times.
✓ Branch 5 → 7 taken 1 time.
13 const char *new_artist = artist ? artist : "";
15
16
5/6
✓ Branch 8 → 9 taken 3 times.
✓ Branch 8 → 14 taken 10 times.
✓ Branch 10 → 11 taken 3 times.
✗ Branch 10 → 14 not taken.
✓ Branch 12 → 13 taken 2 times.
✓ Branch 12 → 14 taken 1 time.
16 if (track->playing == playing && cstring_fit_same(track->title, new_title, sizeof(track->title)) &&
17 3 cstring_fit_same(track->artist, new_artist, sizeof(track->artist)))
18 {
19 2 return false;
20 }
21
22 11 cstring_fit(track->title, new_title, sizeof(track->title));
23 11 cstring_fit(track->artist, new_artist, sizeof(track->artist));
24 11 track->playing = playing;
25 11 return true;
26 }
27
28 2 bool music_track_has(const MusicTrack *track)
29 {
30
3/4
✓ Branch 2 → 3 taken 2 times.
✗ Branch 2 → 4 not taken.
✓ Branch 3 → 4 taken 1 time.
✓ Branch 3 → 5 taken 1 time.
2 return track->title[0] != '\0' || track->artist[0] != '\0';
31 }
32