test-mail-index-transaction-finish.c revision d97f939b1c09e9f90b01b6f81bfb1c05da990148
/* Copyright (c) 2009-2017 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"
void mail_index_update_day_headers(struct mail_index_transaction *t ATTR_UNUSED, time_t day_stamp ATTR_UNUSED) {}
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];
}
#define MAIL_INDEX_TRANSACTION_FINISH(t, n_so_far) \
static void
test_mail_index_transaction_finish_flag_updates(unsigned int n_so_far)
{
struct mail_index_transaction *t;
const struct mail_index_flag_update *updates;
struct mail_index_flag_update u;
unsigned int count;
i_zero(&u);
/* test fast path: all changed */
/* nothing changed */
/* some changes */
test_end();
}
static void
test_mail_index_transaction_finish_check_conflicts(unsigned int n_so_far)
{
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;
/* 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(unsigned int n_so_far)
{
struct mail_index_transaction *t;
const struct mail_transaction_modseq_update *ups;
struct mail_transaction_modseq_update u;
unsigned int count;
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(unsigned int n_so_far)
{
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_end();
}
static void test_state_reset(void)
{
}
static void test_mail_index_transaction_finish(void)
{
void (*const test_finish_functions[])(unsigned int) = {
};
unsigned int i, j;
for (i = 0; i < N_ELEMENTS(test_finish_functions); i++) {
for (j = 0; j < 3; j++) {
test_finish_functions[i](j);
}
}
}
int main(void)
{
static void (*const test_functions[])(void) = {
};
return test_run(test_functions);
}