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-2018 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)

PARENTS

CHILDREN

SOURCE

32 #if defined HAVE_CONFIG_H
33 #include "config.h"
34 #endif
35 
36 program test_md5_sum_from_string
37 
38 use defs_basis, only: ch10,std_out
39 use m_hash_md5
40 
41 !This section has been created automatically by the script Abilint (TD).
42 !Do not modify the following lines by hand.
43 #undef ABI_FUNC
44 #define ABI_FUNC 'test_md5_sum_from_string'
45 !End of the abilint section
46 
47 implicit none
48 
49 character(len=*), parameter  :: abinit_input_string = "ABINIT" // ch10
50 character(len=32), parameter :: abinit_md5_ref = &
51 &                                 "1c57f60933157a3b6e13def40286f0c5"
52 
53 character(len=32) :: chk_value
54 logical :: test_ok
55 
56 #if defined DEBUG_MODE
57 write(std_out,'(a,a)') "Unitary test: md5_sum_from_string", ch10
58 write(std_out,'(1x,a," = ",a)') "Reference MD5 sum", abinit_md5_ref
59 #endif
60 
61 chk_value = md5_sum_from_string(abinit_input_string)
62 
63 #if defined DEBUG_MODE
64 write(std_out,'(1x,a," = ",a)') "Computed  MD5 sum", chk_value
65 #endif
66 
67 ! Report test result
68 test_ok = md5_check(abinit_md5_ref, chk_value)
69 #if defined DEBUG_MODE
70 write(std_out,*)
71 if ( test_ok ) then
72   write(std_out,'(a,a)') "TEST OK", ch10
73 else
74   write(std_out,'(a,a)') "TEST FAILED", ch10
75 end if
76 #else
77 if ( .not. test_ok ) then
78   write(std_out,'(a,a)') "TEST FAILED", ch10
79 end if
80 #endif
81 
82 end program test_md5_sum_from_string