diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-09-30 05:15:58 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-09-30 05:15:58 +0200 |
commit | dbf37dc16ad9549ce5a1021c74fe369ab2e0d917 (patch) | |
tree | 3f382aed7d12f162272b503208ea05c58b8e6d1c /tests | |
parent | 04bf0b7cbe98c70d7e434e24a3eb4b03889c0c56 (diff) |
Move integer and bool function to separate source/testscript files
Diffstat (limited to 'tests')
-rw-r--r-- | tests/function/builtin/testscript | 41 | ||||
-rw-r--r-- | tests/function/integer/buildfile | 4 | ||||
-rw-r--r-- | tests/function/integer/testscript | 41 |
3 files changed, 47 insertions, 39 deletions
diff --git a/tests/function/builtin/testscript b/tests/function/builtin/testscript index 3c430d7..714a38d 100644 --- a/tests/function/builtin/testscript +++ b/tests/function/builtin/testscript @@ -77,43 +77,6 @@ $* <'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 -: -{ - $* <'print $string([uint64] 0xffff)' >'65535' : uint - $* <'print $string([uint64] 0xffff, 16)' >'0xffff' : uint-hex - $* <'print $string([uint64] 0xffff, 16, 8)' >'0x0000ffff' : uint-hex-width -} - -: sort -: -{ - $* <'print $sort([uint64s] 0 2 1 000)' >'0 0 1 2' : basics - $* <'print $sort([uint64s] 0 2 1 000, dedup)' >'0 1 2' : dedup -} - -: find -: -{ - $* <'print $find([uint64s] 1 2 3, 2)' >'true' : basics-true - $* <'print $find([uint64s] 1 2 3, 0)' >'false' : basics-false -} - -: find_index -: -{ - $* <'print $find_index([int64s] -1 -2 -3, -2)' >'1' : basics-true - $* <'print $find_index([int64s] -1 -2 -3, 0)' >'3' : basics-false -} - : getenv : { @@ -123,8 +86,8 @@ : likely is set at the time of login, and on Windows it is set by build2 on : startup. : - : @@ Use a custom variable, when an ability to set environment variables in - : testscript is implemented. + : @@ TMP Use a custom variable, when an ability to set environment variables + : in testscript is implemented. It is now! : { : string diff --git a/tests/function/integer/buildfile b/tests/function/integer/buildfile new file mode 100644 index 0000000..308fe09 --- /dev/null +++ b/tests/function/integer/buildfile @@ -0,0 +1,4 @@ +# file : tests/function/integer/buildfile +# license : MIT; see accompanying LICENSE file + +./: testscript $b diff --git a/tests/function/integer/testscript b/tests/function/integer/testscript new file mode 100644 index 0000000..ad2d3bb --- /dev/null +++ b/tests/function/integer/testscript @@ -0,0 +1,41 @@ +# file : tests/function/integer/testscript +# license : MIT; see accompanying LICENSE file + +.include ../../common.testscript + +: 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 +: +{ + $* <'print $string([uint64] 0xffff)' >'65535' : uint + $* <'print $string([uint64] 0xffff, 16)' >'0xffff' : uint-hex + $* <'print $string([uint64] 0xffff, 16, 8)' >'0x0000ffff' : uint-hex-width +} + +: sort +: +{ + $* <'print $sort([uint64s] 0 2 1 000)' >'0 0 1 2' : basics + $* <'print $sort([uint64s] 0 2 1 000, dedup)' >'0 1 2' : dedup +} + +: find +: +{ + $* <'print $find([uint64s] 1 2 3, 2)' >'true' : basics-true + $* <'print $find([uint64s] 1 2 3, 0)' >'false' : basics-false +} + +: find_index +: +{ + $* <'print $find_index([int64s] -1 -2 -3, -2)' >'1' : basics-true + $* <'print $find_index([int64s] -1 -2 -3, 0)' >'3' : basics-false +} |