diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-09-22 13:10:08 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-09-22 13:10:08 +0200 |
commit | 7d137fd6a9ceb54574481082e9944de168b06b78 (patch) | |
tree | 973e78cd6cf64ca53b50f5dbc026449e945cdaeb /tests/function | |
parent | 7b9c113d52bbcecf45c9407e4ee30ee559418cb2 (diff) |
Add $integer_sequence(<begin>, <end>[, <step>]) function
It returns the list of uint64 integers starting from <begin> (including)
to <end> (excluding) with the specified <step> or 1 if unspecified. For
example:
hdr = foo.hxx bar.hxx baz.hxx
src = foo.cxx bar.cxx baz.cxx
assert ($size($hdr) == $size($src)) "hdr and src expected to be parallel"
for i: $integer_sequence(0, $size($hdr))
{
h = ($hdr[$i])
s = ($src[$i])
...
}
Diffstat (limited to 'tests/function')
-rw-r--r-- | tests/function/builtin/testscript | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/function/builtin/testscript b/tests/function/builtin/testscript index 02c73ee..bbfd4e5 100644 --- a/tests/function/builtin/testscript +++ b/tests/function/builtin/testscript @@ -77,6 +77,14 @@ $* <'print $type($identity(abc))' >'' : untyped } +: integer-sequence +: +{ + $* <'print $integer_sequence(1, 3)' >'1 2' : basics + $* <'print $integer_sequence(1, 0)' >'' : empty + $* <'print $integer_sequence(0, 8, 2)' >'0 2 4 6' : step +} + : string : { |