~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to gnulib-tests/test-strtoimax.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- buffer-read-only: t -*- vi: set ro: */
2
 
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3
1
/*
4
 
 * Copyright (C) 2011 Free Software Foundation, Inc.
 
2
 * Copyright (C) 2011-2012 Free Software Foundation, Inc.
5
3
 *
6
4
 * This program is free software: you can redistribute it and/or modify
7
5
 * it under the terms of the GNU General Public License as published by
146
144
    ASSERT (errno == 0);
147
145
  }
148
146
 
 
147
  /* Large integer values.  */
 
148
  {
 
149
    const char input[] = "2147483647";
 
150
    char *ptr;
 
151
    intmax_t result;
 
152
    errno = 0;
 
153
    result = strtoimax (input, &ptr, 10);
 
154
    ASSERT (result == 2147483647);
 
155
    ASSERT (ptr == input + 10);
 
156
    ASSERT (errno == 0);
 
157
  }
 
158
  {
 
159
    const char input[] = "-2147483648";
 
160
    char *ptr;
 
161
    intmax_t result;
 
162
    errno = 0;
 
163
    result = strtoimax (input, &ptr, 10);
 
164
    ASSERT (result == -2147483647 - 1);
 
165
    ASSERT (ptr == input + 11);
 
166
    ASSERT (errno == 0);
 
167
  }
 
168
  if (sizeof (intmax_t) > sizeof (int))
 
169
    {
 
170
      const char input[] = "4294967295";
 
171
      char *ptr;
 
172
      intmax_t result;
 
173
      errno = 0;
 
174
      result = strtoimax (input, &ptr, 10);
 
175
      ASSERT (result == (intmax_t) 65535 * (intmax_t) 65537);
 
176
      ASSERT (ptr == input + 10);
 
177
      ASSERT (errno == 0);
 
178
    }
 
179
 
149
180
  return 0;
150
181
}