Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

acc: allocation resilient to aliased input/output #134

Merged
merged 16 commits into from
Nov 1, 2021
Merged
Prev Previous commit
Next Next commit
acc/pass: idempotency check
mmcloughlin committed Nov 1, 2021
commit 3a0e3a82fa60616c7e74926597abbe611fea9d4e
28 changes: 17 additions & 11 deletions acc/pass/pass_test.go
Original file line number Diff line number Diff line change
@@ -100,13 +100,16 @@ func TestIndexes(t *testing.T) {
},
}

if err := Indexes(p); err != nil {
t.Fatal(err)
}
// Twice to check idempotency.
for i := 0; i < 2; i++ {
if err := Indexes(p); err != nil {
t.Fatal(err)
}

expect := []int{0, 2, 5, 9}
if !reflect.DeepEqual(expect, p.Indexes) {
t.FailNow()
expect := []int{0, 2, 5, 9}
if !reflect.DeepEqual(expect, p.Indexes) {
t.FailNow()
}
}
}

@@ -148,11 +151,14 @@ func TestReadCounts(t *testing.T) {
5: 1,
}

if err := ReadCounts(p); err != nil {
t.Fatal(p)
}
// Twice to check idempotency.
for i := 0; i < 2; i++ {
if err := ReadCounts(p); err != nil {
t.Fatal(p)
}

if !reflect.DeepEqual(expect, p.ReadCount) {
t.FailNow()
if !reflect.DeepEqual(expect, p.ReadCount) {
t.FailNow()
}
}
}