mariadb/storage/tokudb/tests/sint_test.cc
Rich Prohaska 98b46119e1 refs #6184 port some handlerton test to darwin
git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@54621 c7de825b-a66e-492c-adef-691d508d4ae1
2013-04-17 00:02:19 -04:00

29 lines
691 B
C++

#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/types.h>
#include <tokudb_math.h>
using namespace tokudb;
static void test(int length_bits) {
int64_t max = (1ULL << (length_bits-1)) - 1;
for (int64_t x = -max-1; x <= max; x++) {
for (int64_t y = -max-1; y <= max; y++) {
bool over;
int64_t n = int_add(x, y, length_bits, &over);
printf("%"PRId64" %"PRId64" %"PRId64" %u\n", x, y, n, over);
}
}
}
int main(int argc, char *argv[]) {
if (argc > 1) {
for (int i = 1; i < argc; i++) {
test(atoi(argv[i]));
}
}
return 0;
}