/*
* Copyright (C) 2011 Andrea Mazzoleni
*
* 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
* 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 .
*/
#include "portable.h"
#include "snapraid.h"
#include "util.h"
#include "raid.h"
struct hash_test_vector {
const char* data;
int len;
unsigned char digest[HASH_SIZE];
};
/**
* Test vectors for MurmorHash3_x86_128
*/
static struct hash_test_vector TEST_MURMUR3[] = {
#include "murmur3test.c"
{ 0, 0, { 0 } }
};
/**
* Test vectors for SpookyHash_128
*/
static struct hash_test_vector TEST_SPOOKY2[] = {
#include "spooky2test.c"
{ 0, 0, { 0 } }
};
static void raid5test(unsigned diskmax, unsigned block_size)
{
void* buffer_alloc;
unsigned char** buffer;
unsigned char* buffer_save;
unsigned buffermax;
unsigned i, j;
buffermax = diskmax + 1 + 1;
buffer = malloc_nofail_vector_align(buffermax, block_size, &buffer_alloc);
buffer_save = buffer[buffermax-1];
/* fill with random */
for(i=0;i