#include "ConflictSet.h"

#include <assert.h>

int main(void) {
  ConflictSet *cs = ConflictSet_create(0);
  ConflictSet_WriteRange w;
  ConflictSet_Result result;
  ConflictSet_ReadRange r;
  int64_t bytes;
  w.begin.p = (const uint8_t *)"0000";
  w.begin.len = 4;
  w.end.len = 0;
  ConflictSet_addWrites(cs, &w, 1, 1);
  r.begin.p = (const uint8_t *)"0000";
  r.begin.len = 4;
  r.end.len = 0;
  r.readVersion = 0;
  ConflictSet_check(cs, &r, &result, 1);
  assert(result == ConflictSet_Conflict);
  bytes = ConflictSet_getBytes(cs);
  assert(bytes > 0);
  ConflictSet_destroy(cs);
  return 0;
}
