File: set_test_01.f90

package info (click to toggle)
lfortran 0.60.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 58,416 kB
  • sloc: cpp: 173,406; f90: 80,491; python: 17,586; ansic: 9,610; yacc: 2,356; sh: 1,401; fortran: 895; makefile: 38; javascript: 15
file content (22 lines) | stat: -rw-r--r-- 739 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
program lp_set_test_01
   integer :: x

   _lfortran_set(integer) :: test_set
   test_set = _lfortran_set_constant(1, 2, 3, 4, 4, 5, 4, 10)
   call _lfortran_set_add(test_set, 1)
   call _lfortran_set_add(test_set, 10)
   call _lfortran_set_add(test_set, 11)
   x = _lfortran_len(test_set)
   if (x /= 7) error stop

   test_set = _lfortran_set_constant(1, 2, 3, 4)
   if (_lfortran_len(test_set) /= 4) error stop
   call _lfortran_set_add(test_set, -50)
   if (_lfortran_len(test_set) /= 5) error stop

   type(_lfortran_set(integer)) :: test_set_
   test_set_ = _lfortran_set_constant(3, 4, 8, 5, 4, 10)
   call _lfortran_set_add(test_set_, 1)
   if (_lfortran_len(test_set_) /= 6) error stop
   ! Add other intrinsics later
end program