File: meson.build

package info (click to toggle)
numpy 1%3A2.2.4%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 83,420 kB
  • sloc: python: 248,499; asm: 232,365; ansic: 216,874; cpp: 135,657; f90: 1,540; sh: 938; fortran: 558; makefile: 409; sed: 139; xml: 109; java: 92; perl: 79; cs: 54; javascript: 53; objc: 29; lex: 13; yacc: 9
file content (53 lines) | stat: -rw-r--r-- 1,264 bytes parent folder | download | duplicates (6)
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
project('foreach', 'c')

tests = [['test1', 'prog1', 'prog1.c'],
  ['test2', 'prog2', 'prog2.c', 'fallback'],
  ['test3', 'prog3', 'prog3.c', 'urgh']]

assert(tests[0].get(3, 'fallbck') == 'fallbck', 'array #1 fallback did not match')
assert(tests[1].get(3, 'failbk') == 'fallback', 'array #2 value did not match')
assert(tests[2].get(3, 'urgh') == 'urgh', 'array #3 value did not match')

foreach i : tests
  test(i.get(0), executable(i.get(1), i.get(2), install : true))

  # Ensure that changing the tests variable does not
  # affect ongoing iteration in the foreach loop.
  #
  # Being able to do that would make Meson Turing complete and
  # we definitely don't want that.
  tests = ['test4', 'prog4', 'prog4.c']
endforeach

items = ['a', 'continue', 'b', 'break', 'c']
result = []
foreach i : items
  if i == 'continue'
    continue
  elif i == 'break'
    break
  endif
  result += i
endforeach

assert(result == ['a', 'b'], 'Continue or break in foreach failed')

items = []
iter = range(2)
foreach i : iter
  items += i
endforeach
assert(items == [0, 1])
assert(iter[1] == 1)

items = []
foreach i : range(1, 2)
  items += i
endforeach
assert(items == [1])

items = []
foreach i : range(1, 10, 2)
  items += i
endforeach
assert(items == [1, 3, 5, 7, 9])