test-mail-index-transaction-finish.c revision 8fcf84e6b7a55049a6d407b17af50d6ae8c6386f
/* Copyright (c) 2009-2014 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "test-common.h"
#include "mail-index-private.h"
#include "mail-index-modseq.h"
#include "mail-index-transaction-private.h"
#include <stdlib.h>
void mail_index_update_modseq(struct mail_index_transaction *t ATTR_UNUSED, uint32_t seq ATTR_UNUSED,
const struct mail_index_record *
{
}
struct mail_index_record *
{
}
{
}
{
return modseqs[0];
}
static void test_mail_index_transaction_finish_flag_updates(void)
{
struct mail_index_transaction *t;
const struct mail_index_flag_update *updates;
struct mail_index_flag_update u;
unsigned int count;
memset(&u, 0, sizeof(u));
test_begin("mail index transaction finish flag updates");
/* test fast path: all changed */
/* nothing changed */
/* some changes */
test_end();
}
static void test_mail_index_transaction_finish_check_conflicts(void)
{
struct mail_index_transaction *t;
unsigned int count;
t->min_flagupdate_seq = 5;
t->max_flagupdate_seq = 8;
t->conflict_seqs = &conflict_seqs;
modseqs[0] = 1234;
test_begin("mail index transaction finish check conflicts");
/* fast path: no conflicts */
t->max_modseq = 1234;
/* try some conflicts */
t->max_modseq = 6;
test_end();
array_free(t->conflict_seqs);
}
static void test_mail_index_transaction_finish_modseq_updates(void)
{
struct mail_index_transaction *t;
const struct mail_transaction_modseq_update *ups;
struct mail_transaction_modseq_update u;
unsigned int count;
test_begin("mail index transaction finish modseq updates");
u.modseq_low32 = 1234567890;
u.modseq_high32 = 987654321;
u.modseq_low32++;
u.modseq_high32++;
u.modseq_low32++;
u.modseq_high32++;
u.modseq_low32 = 1234;
u.modseq_high32 = 0;
test_end();
}
static void test_mail_index_transaction_finish_expunges(void)
{
struct mail_index_transaction *t;
const struct mail_transaction_expunge_guid *expunges;
struct mail_transaction_expunge_guid expunge;
unsigned int i, count;
for (i = 0; i < sizeof(guid2); i++) {
guid1[i] = i + 1;
guid2[i] = i ^ 0xff;
guid3[i] = i + 0x80;
}
t->expunges_nonsorted = TRUE;
test_begin("mail index transaction finish expunges");
test_end();
}
int main(void)
{
static void (*test_functions[])(void) = {
};
unsigned int i;
return test_run(test_functions);
}