diff options
Diffstat (limited to 'tests/custom/03_stdlib/08_int')
-rw-r--r-- | tests/custom/03_stdlib/08_int | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/custom/03_stdlib/08_int b/tests/custom/03_stdlib/08_int index 12db299..eae4904 100644 --- a/tests/custom/03_stdlib/08_int +++ b/tests/custom/03_stdlib/08_int @@ -1,8 +1,9 @@ The `int()` function converts the given value into a signed integer -value and returns the resulting number. +value and returns the resulting number. In case the value is of type +string, a second optional base argument may be specified which is +passed to the underlying strtoll(3) implementation. Returns `NaN` if the given argument is not convertible into a number. - Returns `NaN` if the conversion result is out of range. -- Testcase -- @@ -19,7 +20,11 @@ Returns `NaN` if the conversion result is out of range. int("0xffffffffffffffff"), int("0177"), int("+145"), - int("-96") + int("-96"), + int("0177", 8), + int("0x1000", 16), + int("1111", 2), + int("0xffffffffffffffff", 16) ]); %} -- End -- @@ -37,6 +42,10 @@ Returns `NaN` if the conversion result is out of range. 0, 177, 145, - -96 + -96, + 127, + 4096, + 15, + "NaN" ] -- End -- |