Skip to content

Commit

Permalink
Merge pull request #10 from vulcanize/ian_dev
Browse files Browse the repository at this point in the history
minor fix to Tracked tests
  • Loading branch information
i-norden authored Aug 16, 2023
2 parents ffbebf5 + 3e85274 commit caa6ccb
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions amt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,10 @@ func TestForEachParallelTracked(t *testing.T) {
}
}
m.Lock()
_, ok := expectedTrails[trailStr]
if !ok {
return fmt.Errorf("unexpected trail: %s", trailStr)
}
delete(expectedTrails, trailStr)
delete(foundVals, i)
m.Unlock()
Expand Down Expand Up @@ -1128,7 +1132,6 @@ func TestForEachParallelTracked(t *testing.T) {
trail += fmt.Sprintf("%d", j)
expectedTrails[trail] = struct{}{}
}
expectedTrails[trail] = struct{}{}
}

err = a.ForEachParallelTracked(ctx, 16, func(i uint64, v *cbg.Deferred, trail []int) error {
Expand All @@ -1141,6 +1144,10 @@ func TestForEachParallelTracked(t *testing.T) {
}
}
m.Lock()
_, ok := expectedTrails[trailStr]
if !ok {
return fmt.Errorf("unexpected trail: %s", trailStr)
}
delete(expectedTrails, trailStr)
delete(foundVals, i)
m.Unlock()
Expand Down Expand Up @@ -1177,7 +1184,6 @@ func TestForEachParallelTracked(t *testing.T) {
trail += fmt.Sprintf("%d", j)
expectedTrails[trail] = struct{}{}
}
expectedTrails[trail] = struct{}{}
}

err = a.ForEachParallelTracked(ctx, 16, func(i uint64, v *cbg.Deferred, trail []int) error {
Expand All @@ -1190,6 +1196,10 @@ func TestForEachParallelTracked(t *testing.T) {
}
}
m.Lock()
_, ok := expectedTrails[trailStr]
if !ok {
return fmt.Errorf("unexpected trail: %s", trailStr)
}
delete(expectedTrails, trailStr)
delete(foundVals, i)
m.Unlock()
Expand Down Expand Up @@ -1248,8 +1258,8 @@ func TestForEachParallelTrackedWithNodeSink(t *testing.T) {
for j := 0; j < widthInt; j++ {
trail = fmt.Sprintf("%d, ", i)
trail += fmt.Sprintf("%d", j)
expectedTrails[trail] = struct{}{}
}
expectedTrails[trail] = struct{}{}
}

err = a.ForEachParallelTrackedWithNodeSink(ctx, 16, b, counterSink, func(i uint64, v *cbg.Deferred, trail []int) error {
Expand All @@ -1262,6 +1272,10 @@ func TestForEachParallelTrackedWithNodeSink(t *testing.T) {
}
}
m.Lock()
_, ok := expectedTrails[trailStr]
if !ok {
return fmt.Errorf("unexpected trail: %s", trailStr)
}
delete(expectedTrails, trailStr)
delete(foundVals, i)
m.Unlock()
Expand Down Expand Up @@ -1318,6 +1332,10 @@ func TestForEachParallelTrackedWithNodeSink(t *testing.T) {
}
}
m.Lock()
_, ok := expectedTrails[trailStr]
if !ok {
return fmt.Errorf("unexpected trail: %s", trailStr)
}
delete(expectedTrails, trailStr)
delete(foundVals, i)
m.Unlock()
Expand Down Expand Up @@ -1371,6 +1389,10 @@ func TestForEachParallelTrackedWithNodeSink(t *testing.T) {
}
}
m.Lock()
_, ok := expectedTrails[trailStr]
if !ok {
return fmt.Errorf("unexpected trail: %s", trailStr)
}
delete(expectedTrails, trailStr)
delete(foundVals, i)
m.Unlock()
Expand Down

0 comments on commit caa6ccb

Please sign in to comment.