strtonum-tests.c revision 8f3f857e227bdec008c9b80c2830cb3a389253af
/*
SSSD
InfoPipe
Copyright (C) Stephen Gallagher <sgallagh@redhat.com> 2009
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <check.h>
#include <errno.h>
#include <popt.h>
#include "util/strtonum.h"
/********************
* Utility routines *
********************/
#define EXPECT_UNSET_ERRNO(error) \
do { \
} while(0)
do { \
} while(0)
do { \
} while(0)
do { \
} while(0)
#define CHECK_ZERO_ENDPTR(endptr) \
do { \
} while(0)
/******************
* strtoint tests *
******************/
/* Base-10 */
{
const char *input = "123";
char *endptr;
}
{
const char *input = "-123";
char *endptr;
}
{
const char *input = "2147483647";
char *endptr;
}
{
const char *input = "-2147483648";
char *endptr;
}
{
const char *input = "8589934592";
char *endptr;
}
{
const char *input = "-8589934592";
char *endptr;
}
{
const char *input = "12b13";
char *endptr;
}
{
const char *input = "alpha";
char *endptr;
const char *expected_endptr = input;
}
{
const char *input = "alpha12345";
char *endptr;
const char *expected_endptr = input;
}
{
const char *input = "";
char *endptr;
const char *expected_endptr = input;
}
/*******************
* strtouint tests *
*******************/
/* Base-10 */
{
const char *input = "123";
char *endptr;
}
{
const char *input = "-123";
char *endptr;
}
{
const char *input = "4294967295";
char *endptr;
}
{
const char *input = "8589934592";
char *endptr;
}
{
const char *input = "12b13";
char *endptr;
}
{
const char *input = "alpha";
char *endptr;
const char *expected_endptr = input;
}
{
const char *input = "alpha12345";
char *endptr;
const char *expected_endptr = input;
}
{
const char *input = "";
char *endptr;
const char *expected_endptr = input;
}
/* Base-10 */
{
const char *input = "123";
char *endptr;
}
{
const char *input = "-123";
char *endptr;
}
{
const char *input = "65535";
char *endptr;
}
{
const char *input = "131072";
char *endptr;
}
{
const char *input = "12b13";
char *endptr;
}
{
const char *input = "alpha";
char *endptr;
const char *expected_endptr = input;
}
{
const char *input = "alpha12345";
char *endptr;
const char *expected_endptr = input;
}
{
const char *input = "";
char *endptr;
const char *expected_endptr = input;
}
Suite *create_strtonum_suite(void)
{
/* Add all test cases to the suite */
return s;
}
int opt;
int failure_count;
struct poptOption long_options[] = {
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
/* If CK_VERBOSITY is set, use that, otherwise it defaults to CK_NORMAL */
}