File: get_team.f90

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (55 lines) | stat: -rw-r--r-- 1,920 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
! RUN: %python %S/test_errors.py %s %flang_fc1
! Check for semantic errors in get_team(), as defined in
! section 16.9.85 of the Fortran 2018 standard

program get_team_test
  use iso_fortran_env, only: team_type, initial_team, current_team, parent_team
  implicit none

  integer n, array(1), coarray[*]
  type(team_type) :: result_team
  logical wrong_result_type, non_integer

  !___ standard-conforming statement with no optional arguments present ___
  result_team = get_team()

  !___ standard-conforming statements with optional level argument present ___
  result_team = get_team(-1)
  result_team = get_team(-2)
  result_team = get_team(-3)
  result_team = get_team(initial_team)
  result_team = get_team(current_team)
  result_team = get_team(parent_team)
  result_team = get_team(n)
  result_team = get_team(array(1))
  result_team = get_team(array(n))
  result_team = get_team(coarray[1])
  result_team = get_team(level=initial_team)
  result_team = get_team(level=n)

  !___ non-conforming statements ___
  !ERROR: 'level=' argument has unacceptable rank 1
  result_team = get_team(array)

  !ERROR: Actual argument for 'level=' has bad type 'LOGICAL(4)'
  result_team = get_team(non_integer)

  !ERROR: Actual argument for 'level=' has bad type 'REAL(4)'
  result_team = get_team(3.4)

  !ERROR: too many actual arguments for intrinsic 'get_team'
  result_team = get_team(current_team, parent_team)

  !ERROR: Actual argument for 'level=' has bad type 'REAL(4)'
  result_team = get_team(level=3.4)

  !ERROR: unknown keyword argument to intrinsic 'get_team'
  result_team = get_team(levels=initial_team)

  !ERROR: repeated keyword argument to intrinsic 'get_team'
  result_team = get_team(level=initial_team, level=parent_team)

  !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types LOGICAL(4) and TYPE(__builtin_team_type)
  wrong_result_type = get_team()

end program get_team_test