FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavutil/tests/md5.c
Date: 2024-11-20 23:03:26
Exec Total Coverage
Lines: 21 21 100.0%
Functions: 2 2 100.0%
Branches: 6 6 100.0%

Line Branch Exec Source
1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #include <stdint.h>
20 #include <stdio.h>
21
22 #include "libavutil/md5.h"
23
24 5 static void print_md5(uint8_t *md5)
25 {
26 int i;
27
2/2
✓ Branch 0 taken 80 times.
✓ Branch 1 taken 5 times.
85 for (i = 0; i < 16; i++)
28 80 printf("%02x", md5[i]);
29 5 printf("\n");
30 5 }
31
32 1 int main(void)
33 {
34 uint8_t md5val[16];
35 int i;
36
37 uint8_t in[1000];
38
39
2/2
✓ Branch 0 taken 1000 times.
✓ Branch 1 taken 1 times.
1001 for (i = 0; i < 1000; i++)
40 1000 in[i] = i * i;
41 1 av_md5_sum(md5val, in, 1000);
42 1 print_md5(md5val);
43 1 av_md5_sum(md5val, in, 63);
44 1 print_md5(md5val);
45 1 av_md5_sum(md5val, in, 64);
46 1 print_md5(md5val);
47 1 av_md5_sum(md5val, in, 65);
48 1 print_md5(md5val);
49
2/2
✓ Branch 0 taken 1000 times.
✓ Branch 1 taken 1 times.
1001 for (i = 0; i < 1000; i++)
50 1000 in[i] = i % 127;
51 1 av_md5_sum(md5val, in, 999);
52 1 print_md5(md5val);
53
54 1 return 0;
55 }
56