Line data Source code
1 : !> \file test_01.f90
2 : !! \brief Test program for dictionary_m
3 :
4 : !> Define a dictionary_t object, populate it with keys and values, and list the results with
5 : !! the show method. This program also:
6 : !! - requests a non-existing key
7 : !! - write several keys in the same bucket, hence testing reallocation of the bucket
8 : !! - rewrites an existing value
9 :
10 1 : program test_01
11 1 : use dictionary_m
12 : implicit none
13 :
14 1 : type(dictionary_t) :: d
15 :
16 1 : call d%init(10)
17 :
18 1 : call d%set('one', 'one')
19 1 : call d%set('pi', '3.14159')
20 1 : call d%set('abc', 'first three letters from the alphabet')
21 1 : call d%set('1', 'number one')
22 1 : call d%set('a', 'letter a')
23 1 : call d%set('fortran', 'programming language')
24 :
25 1 : write(*,*) 'one', ' = ', d%get('one')
26 1 : write(*,*) 'pi', ' = ', d%get('pi')
27 1 : write(*,*) 'XYZ', ' = ', d%get('XYZ')
28 :
29 :
30 :
31 1 : call d%set('pi', 'pi is the ratio of the perimeter of a circle to its radius')
32 :
33 1 : write(*,*) 'pi', ' = ', d%get('pi')
34 :
35 1 : write(*,*) 'output from the method show'
36 :
37 1 : call d%show()
38 :
39 1 : end program test_01
|