summaryrefslogtreecommitdiff
path: root/gnulib-tests/test-strtoumax.c
diff options
context:
space:
mode:
authorŁukasz Stelmach <l.stelmach@samsung.com>2014-01-15 13:17:08 +0100
committerŁukasz Stelmach <l.stelmach@samsung.com>2014-01-15 13:17:08 +0100
commit90b2de102fe4c773f9d6ba2da2065f254a5803b6 (patch)
treee1fa3d099d6e8eeafd3dd0eef243b8d2f41a0b9b /gnulib-tests/test-strtoumax.c
parent20c6d7ec2c817aa561410130efc8c8254fbef2b2 (diff)
downloaddiffutils-90b2de102fe4c773f9d6ba2da2065f254a5803b6.tar.gz
diffutils-90b2de102fe4c773f9d6ba2da2065f254a5803b6.tar.bz2
diffutils-90b2de102fe4c773f9d6ba2da2065f254a5803b6.zip
Imported Upstream version 3.3upstream/3.3
Diffstat (limited to 'gnulib-tests/test-strtoumax.c')
-rw-r--r--gnulib-tests/test-strtoumax.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/gnulib-tests/test-strtoumax.c b/gnulib-tests/test-strtoumax.c
index 0e638b5..fbacb72 100644
--- a/gnulib-tests/test-strtoumax.c
+++ b/gnulib-tests/test-strtoumax.c
@@ -1,7 +1,5 @@
-/* -*- buffer-read-only: t -*- vi: set ro: */
-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
/*
- * Copyright (C) 2011 Free Software Foundation, Inc.
+ * Copyright (C) 2011-2013 Free Software Foundation, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -146,5 +144,37 @@ main (void)
ASSERT (errno == 0);
}
+ /* Large integer values. */
+ {
+ const char input[] = "2147483647";
+ char *ptr;
+ uintmax_t result;
+ errno = 0;
+ result = strtoumax (input, &ptr, 10);
+ ASSERT (result == 2147483647);
+ ASSERT (ptr == input + 10);
+ ASSERT (errno == 0);
+ }
+ {
+ const char input[] = "-2147483648";
+ char *ptr;
+ uintmax_t result;
+ errno = 0;
+ result = strtoumax (input, &ptr, 10);
+ ASSERT (result == - (uintmax_t) 2147483648U);
+ ASSERT (ptr == input + 11);
+ ASSERT (errno == 0);
+ }
+ {
+ const char input[] = "4294967295";
+ char *ptr;
+ uintmax_t result;
+ errno = 0;
+ result = strtoumax (input, &ptr, 10);
+ ASSERT (result == 4294967295U);
+ ASSERT (ptr == input + 10);
+ ASSERT (errno == 0);
+ }
+
return 0;
}