mariadb/windows/tests/test-strtoll.c
Rich Prohaska 4f46b25a02 rename to toku_portability.h addresses #1269
git-svn-id: file:///svn/toku/tokudb.1032b@7952 c7de825b-a66e-492c-adef-691d508d4ae1
2013-04-16 23:57:29 -04:00

42 lines
799 B
C

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "toku_portability.h"
#include "toku_os.h"
int verbose;
void testit(int64_t i, int base) {
int64_t o;
#define SN 32
char s[SN];
sprintf(s, "%I64d", i);
o = strtoll(s, NULL, base);
if (verbose)
printf("%s: %I64d %I64d %s\n", __FUNCTION__, i, o, s);
assert(i == o);
}
int main(int argc, char *argv[]) {
int i;
int64_t n;
int64_t o;
#define SN 32
char s[SN];
for (i=1; i<argc; i++) {
char *arg = argv[i];
if (strcmp(arg, "-v") == 0 || strcmp(arg, "--verbose") == 0)
verbose++;
}
for (n=0; n<1000; n++) {
testit(n, 10);
}
testit(1I64 << 31, 10);
testit((1I64 << 32) - 1, 10);
testit(1I64 << 32, 10);
return 0;
}