FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavformat/tests/http.c
Date: 2026-08-28 22:32:55
Exec Total Coverage
Lines: 12 14 85.7%
Functions: 2 2 100.0%
Branches: 5 6 83.3%

Line Branch Exec Source
1 /*
2 * Copyright (c) 2026 Romain Beauxis
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 <stdio.h>
22
23 #include "libavformat/http.h"
24
25 22 static void test(const char *line)
26 {
27 HTTPStatusLine st;
28 int ret;
29
30 22 printf("\"%s\"\n", line);
31
32 22 ret = ff_http_parse_status_line(NULL, line, &st);
33
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 6 times.
22 if (ret < 0) {
34 16 printf(" rejected\n");
35 16 return;
36 }
37
38 6 printf(" version=\"%s\" code=%d willclose=%d reason=\"%s\"\n",
39 st.version, st.code, st.willclose, st.reason);
40 }
41
42 1 int main(int argc, char **argv)
43 {
44
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (argc < 2) {
45 fprintf(stderr, "usage: %s <status line>...\n", argv[0]);
46 return 1;
47 }
48
49
2/2
✓ Branch 0 taken 22 times.
✓ Branch 1 taken 1 times.
23 for (int i = 1; i < argc; i++)
50 22 test(argv[i]);
51
52 1 return 0;
53 }
54