LCOV - code coverage report
Current view: top level - libavutil/tests - md5.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 21 21 100.0 %
Date: 2017-10-18 21:45:51 Functions: 2 2 100.0 %

          Line data    Source code
       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          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             :     volatile uint8_t in[1000]; // volatile to workaround http://llvm.org/bugs/show_bug.cgi?id=20849
      37             :     // FIXME remove volatile once it has been fixed and all fate clients are updated
      38             : 
      39        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        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             : }

Generated by: LCOV version 1.13