Add inner-full-word test
All checks were successful
Tests / Clang total: 934, passed: 934
Clang |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap:
Tests / Release [gcc] total: 934, passed: 934
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 933, passed: 933
Tests / Coverage total: 932, passed: 932
weaselab/conflict-set/pipeline/head This commit looks good

This commit is contained in:
2024-03-17 14:42:11 -07:00
parent 1a51aa00e5
commit 5aab76847a
3 changed files with 233 additions and 13 deletions

View File

@@ -507,6 +507,18 @@ inline std::string printable(std::span<const uint8_t> key) {
return printable(std::string_view((const char *)key.data(), key.size()));
}
inline const char *resultToStr(ConflictSet::Result r) {
switch (r) {
case ConflictSet::Commit:
return "commit";
case ConflictSet::Conflict:
return "conflict";
case ConflictSet::TooOld:
return "too old";
}
abort();
}
namespace {
template <class ConflictSetImpl> struct TestDriver {
@@ -523,18 +535,6 @@ template <class ConflictSetImpl> struct TestDriver {
bool ok = true;
static const char *resultToStr(ConflictSet::Result r) {
switch (r) {
case ConflictSet::Commit:
return "commit";
case ConflictSet::Conflict:
return "conflict";
case ConflictSet::TooOld:
return "too old";
}
abort();
}
// Call until it returns true, for "done". Check internal invariants etc
// between calls to next.
bool next() {

View File

@@ -84,6 +84,7 @@ int main(int argc, const char **argv) {
readRanges.push_back(r);
} else if (line.starts_with("pointwrite"_v)) {
printf("pointwrite\n");
// TODO check sorted
ConflictSet::WriteRange w;
w.begin.p = b.data();
w.begin.len = b.size();
@@ -100,6 +101,7 @@ int main(int argc, const char **argv) {
readRanges.push_back(r);
} else if (line.starts_with("rangewrite"_v)) {
printf("rangewrite\n");
// TODO check sorted
ConflictSet::WriteRange w;
w.begin.p = b.data();
w.begin.len = b.size();
@@ -114,7 +116,11 @@ int main(int argc, const char **argv) {
ref.check(readRanges.data(), expected, readRanges.size());
cs.check(readRanges.data(), actual, readRanges.size());
for (int i = 0; i < int(readRanges.size()); ++i) {
assert(expected[i] == actual[i]);
if (expected[i] != actual[i]) {
fprintf(stderr, "Expected %s, got %s at index %d\n",
resultToStr(expected[i]), resultToStr(actual[i]), i);
return 1;
}
}
readRanges = {};
} else if (line.starts_with("addwrites"_v)) {
@@ -126,6 +132,8 @@ int main(int argc, const char **argv) {
printf("setoldest\n");
cs.setOldestVersion(v);
ref.setOldestVersion(v);
} else if (line.empty() || line.starts_with(";"_v)) {
// skip
} else {
printf("Unrecognized line: %.*s\n", int(line.size()), line.data());
}

View File

@@ -0,0 +1,212 @@
; insert \x3fa at version 1
begin ?a
pointwrite
; insert \x81a at version 1
begin a
pointwrite
version 1
addwrites
; insert [\x40-\x80]a at version 2
begin @a
pointwrite
begin Aa
pointwrite
begin Ba
pointwrite
begin Ca
pointwrite
begin Da
pointwrite
begin Ea
pointwrite
begin Fa
pointwrite
begin Ga
pointwrite
begin Ha
pointwrite
begin Ia
pointwrite
begin Ja
pointwrite
begin Ka
pointwrite
begin La
pointwrite
begin Ma
pointwrite
begin Na
pointwrite
begin Oa
pointwrite
begin Pa
pointwrite
begin Qa
pointwrite
begin Ra
pointwrite
begin Sa
pointwrite
begin Ta
pointwrite
begin Ua
pointwrite
begin Va
pointwrite
begin Wa
pointwrite
begin Xa
pointwrite
begin Ya
pointwrite
begin Za
pointwrite
begin [a
pointwrite
begin \a
pointwrite
begin ]a
pointwrite
begin ^a
pointwrite
begin _a
pointwrite
begin `a
pointwrite
begin aa
pointwrite
begin ba
pointwrite
begin ca
pointwrite
begin da
pointwrite
begin ea
pointwrite
begin fa
pointwrite
begin ga
pointwrite
begin ha
pointwrite
begin ia
pointwrite
begin ja
pointwrite
begin ka
pointwrite
begin la
pointwrite
begin ma
pointwrite
begin na
pointwrite
begin oa
pointwrite
begin pa
pointwrite
begin qa
pointwrite
begin ra
pointwrite
begin sa
pointwrite
begin ta
pointwrite
begin ua
pointwrite
begin va
pointwrite
begin wa
pointwrite
begin xa
pointwrite
begin ya
pointwrite
begin za
pointwrite
begin {a
pointwrite
begin |a
pointwrite
begin }a
pointwrite
begin ~a
pointwrite
begin a
pointwrite
version 2
addwrites
; readrange a superset at version 1
begin !
end ‚
version 1
rangeread
check