summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_stdlib/07_hex
blob: 419970cac7f9afc4276edae3eb977b6525df911b (plain)
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
The `hex()` function converts the given hexadecimal string into a signed
integer value and returns the resulting number.

Returns `NaN` if the given argument is not a string, an empty string or
a string containing non-hexadecimal digits.

-- Testcase --
{%
	printf("%.J\n", [
		hex(),
		hex(false),
		hex(123),
		hex(""),
		hex("invalid"),
		hex("deaf"),
		hex("0x1000"),
		hex("ffffffffffffffff")
	]);
%}
-- End --

-- Expect stdout --
[
	"NaN",
	"NaN",
	"NaN",
	"NaN",
	"NaN",
	57007,
	4096,
	9223372036854775807
]
-- End --