TABLE OF CONTENTS


ABINIT/21_hashfuncs/tests/test_md5_sum_from_string [ Programs ]

[ Top ] [ Programs ]

NAME

  test_md5_sum_from_string

FUNCTION

  Unit test for the test_md5_sum_from_string routine of m_hash_md5.

COPYRIGHT

  Copyright (C) 2016-2024 ABINIT Group (Yann Pouillon)
  This file is distributed under the terms of the
  GNU General Public License, see ~abinit/COPYING
  or http://www.gnu.org/copyleft/gpl.txt .
  For the initials of contributors, see
  ~abinit/doc/developers/contributors.txt .

NOTES

  This program is run by "make check".

INPUTS

  (main routine)

OUTPUT

  (main routine)

SOURCE

27 #if defined HAVE_CONFIG_H
28 #include "config.h"
29 #endif
30 
31 program test_md5_sum_from_string
32 
33 use defs_basis, only: ch10,std_out
34 use m_hash_md5
35 implicit none
36 
37 character(len=*), parameter  :: abinit_input_string = "ABINIT" // ch10
38 character(len=32), parameter :: abinit_md5_ref = &
39 &                                 "1c57f60933157a3b6e13def40286f0c5"
40 
41 character(len=32) :: chk_value
42 logical :: test_ok
43 
44 #if defined DEBUG_MODE
45 write(std_out,'(a,a)') "Unitary test: md5_sum_from_string", ch10
46 write(std_out,'(1x,a," = ",a)') "Reference MD5 sum", abinit_md5_ref
47 #endif
48 
49 chk_value = md5_sum_from_string(abinit_input_string)
50 
51 #if defined DEBUG_MODE
52 write(std_out,'(1x,a," = ",a)') "Computed  MD5 sum", chk_value
53 #endif
54 
55 ! Report test result
56 test_ok = md5_check(abinit_md5_ref, chk_value)
57 #if defined DEBUG_MODE
58 write(std_out,*)
59 if ( test_ok ) then
60   write(std_out,'(a,a)') "TEST OK", ch10
61 else
62   write(std_out,'(a,a)') "TEST FAILED", ch10
63 end if
64 #else
65 if ( .not. test_ok ) then
66   write(std_out,'(a,a)') "TEST FAILED", ch10
67 end if
68 #endif
69 
70 end program test_md5_sum_from_string