libsim  Versione 7.1.9
list_test.f90
1 PROGRAM list_test
2 USE list_integer
3 IMPLICIT NONE
4 
5 TYPE(integerlist) :: tlist1
6 
7 INTEGER :: i, j, res(13)=(/50,100,40,300,30,500,20,10,1,2,3,4,5/)
8 
9 DO i = 1, 5
10  CALL tlist1%append(i)
11  CALL tlist1%prepend(i*10)
12 ENDDO
13 
14 DO i = 1, 5, 2
15  IF (.NOT.tlist1%insert(i*100, i)) THEN
16  print*,'Unexpected error in insert at position ',i
17  CALL exit(1)
18  ENDIF
19 ENDDO
20 
21 IF (tlist1%countelements() /= 13) THEN
22  print*,'Wrong list length: ',tlist1%countelements()
23  CALL exit(1)
24 ENDIF
25 
26 CALL tlist1%rewind()
27 DO WHILE(tlist1%element())
28  j = tlist1%current()
29  IF (j /= res(tlist1%currentindex())) THEN
30  print*,'Element ',tlist1%currentindex(),' has wrong value ',j
31  CALL exit(1)
32  ENDIF
33  CALL tlist1%next()
34 ENDDO
35 
36 END PROGRAM list_test
class to use lists in fortran 2003.

Generated with Doxygen.