doc: use ASCII in .texi files where UTF-8 isn't needed
[gnulib.git] / tests / test-strtoumax.c
index acc851c..77f490f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Free Software Foundation, Inc.
+ * Copyright (C) 2011-2014 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
@@ -144,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;
 }