Added some more HEX (hex_to_dec()) Fun. (0.3714)
This commit is contained in:
parent
d2fca3275a
commit
9577f26e23
6 changed files with 131 additions and 11 deletions
32
examples/test_hex_to_dec.fun
Executable file
32
examples/test_hex_to_dec.fun
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env fun
|
||||
|
||||
/*
|
||||
* This file is part of the Fun programming language.
|
||||
* https://fun-lang.xyz/
|
||||
*
|
||||
* Copyright 2025 Johannes Findeisen <you@hanez.org>
|
||||
* Licensed under the terms of the Apache-2.0 license.
|
||||
* https://opensource.org/license/apache-2-0
|
||||
*
|
||||
* Added: 2025-12-18
|
||||
*/
|
||||
|
||||
#include <hex.fun>
|
||||
|
||||
print("Testing hex_to_dec:")
|
||||
print("0x0 -> " + to_string(hex_to_dec("0")))
|
||||
print("0xf -> " + to_string(hex_to_dec("f")))
|
||||
print("0x10 -> " + to_string(hex_to_dec("10")))
|
||||
print("0xff -> " + to_string(hex_to_dec("ff")))
|
||||
print("0x100 -> " + to_string(hex_to_dec("100")))
|
||||
print("0xdeadbeef -> " + to_string(hex_to_dec("deadbeef")))
|
||||
|
||||
/* Expected output:
|
||||
Testing hex_to_dec:
|
||||
0x0 -> 0
|
||||
0xf -> 15
|
||||
0x10 -> 16
|
||||
0xff -> 255
|
||||
0x100 -> 256
|
||||
0xdeadbeef -> 3735928559
|
||||
*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue