FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavformat/tests/seek_utils.c
Date: 2024-05-03 15:42:48
Exec Total Coverage
Lines: 17 20 85.0%
Functions: 1 1 100.0%
Branches: 9 18 50.0%

Line Branch Exec Source
1 /*
2 * Copyright (c) 2022 Pierre-Anthony Lemieux <pal@palemieux.com>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include "libavformat/demux.h"
22
23 1 int main(void)
24 {
25 int64_t ts_min;
26 int64_t ts;
27 int64_t ts_max;
28
29 1 ts_min = 10;
30 1 ts = 20;
31 1 ts_max = 30;
32
33 1 ff_rescale_interval(av_make_q(1, 1), av_make_q(10, 1), &ts_min, &ts, &ts_max);
34
35
3/6
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
1 if (ts_min != 1 || ts != 2 || ts_max != 3)
36 return 1;
37
38 1 ts_min = 10;
39 1 ts = 32;
40 1 ts_max = 32;
41
42 1 ff_rescale_interval(av_make_q(1, 1), av_make_q(3, 1), &ts_min, &ts, &ts_max);
43
44
3/6
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
1 if (ts_min != 4 || ts != 11 || ts_max != 10)
45 return 1;
46
47 1 ts_min = 10;
48 1 ts = 10;
49 1 ts_max = 32;
50
51 1 ff_rescale_interval(av_make_q(1, 1), av_make_q(3, 1), &ts_min, &ts, &ts_max);
52
53
3/6
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
1 if (ts_min != 4 || ts != 3 || ts_max != 10)
54 return 1;
55
56 1 return 0;
57 }
58