diff options
author | Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> | 2017-05-26 13:58:57 +0530 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-05-31 16:58:05 +1000 |
commit | 41bb3e7cd4eda5371d7cd0310e31357550279ccd (patch) | |
tree | 62e6d7dfea5e419444162a8dee2e9abe72bb7776 /libc/test | |
parent | 1d4a0a4374f69c890b64f5463930775d94139ded (diff) | |
download | skiboot-41bb3e7cd4eda5371d7cd0310e31357550279ccd.zip skiboot-41bb3e7cd4eda5371d7cd0310e31357550279ccd.tar.gz skiboot-41bb3e7cd4eda5371d7cd0310e31357550279ccd.tar.bz2 |
libc: Add labs() to stdlib
Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
Acked-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libc/test')
-rw-r--r-- | libc/test/run-stdlib.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libc/test/run-stdlib.c b/libc/test/run-stdlib.c index 1f3a2e1..bf17604 100644 --- a/libc/test/run-stdlib.c +++ b/libc/test/run-stdlib.c @@ -85,5 +85,12 @@ int main(void) assert(strtoul("z", NULL, 36) == 35); assert(strtoul("Y", NULL, 36) == 34); + /* labs - ensure it returns absolute value */ + assert(labs(0) == 0); + assert(labs(2147483647) == 2147483647); + assert(labs(-2147483647) == 2147483647); + assert(labs(9223372036854775807) == 9223372036854775807); + assert(labs(-9223372036854775807) == 9223372036854775807); + return 0; } |