Skip to content

Commit

Permalink
distinguish tiles from slabs as they should be
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieucaroff committed Jun 3, 2024
1 parent a8ebba5 commit 3937599
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 40 deletions.
10 changes: 5 additions & 5 deletions go/specimen/nodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (n *Nodule) Populate(dataMatrix orderedstringmap.OSM) (err error) {

// TODO: make it so inserting a key in n.DataOrder checks and when present, removes the older instance of the key.

func (n *Nodule) NewResolveDataMatrixIterator() func() Dict {
func (n *Nodule) NewResolveDataMatrixIterator() func() (Dict, int) {
// reverse the dataOrder so that we iterate quickly on the latest keys, and
// more slowly in the earlier keys
length := n.DataMatrix.Len()
Expand Down Expand Up @@ -151,13 +151,13 @@ func (n *Nodule) NewResolveDataMatrixIterator() func() Dict {

// Create a closure-based iterator function
index := 0
return func() Dict {
return func() (Dict, int) {
if index == 0 {
index += 1
return combination
return combination, (index - 1)
} else if index == totalCombinations {
index += 1
return nil
return nil, (index - 1)
}

// Go through the keys to find which one is affected by the index change
Expand All @@ -175,6 +175,6 @@ func (n *Nodule) NewResolveDataMatrixIterator() func() Dict {
}
}
index += 1
return combination
return combination, (index - 1)
}
}
59 changes: 29 additions & 30 deletions go/specimen/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,45 +66,44 @@ func Run(t *testing.T, boxFunction BoxFunction, fileSlice []File) {
// Nodule Run
iterator := slab.NewResolveDataMatrixIterator()
for {
tile := iterator()
tile, index := iterator()
if tile == nil {
break
}
slab.runBoxFunction(&s, tile, boxFunction)
}

// Nodule End
s.slabCount += 1
switch s.status {
case Pristine:
s.slabPassed += 1
case Failed:
s.slabFailed += 1
case Aborted:
s.slabAborted += 1
case Panicked:
s.slabPanicked += 1
}
// summarize the failures
if s.status != Pristine {
slabInfo := fmt.Sprintf("(%s)", slab.GetLocation())

info := strings.Join(s.failInfo, "; ")

message := ""
s.tileCount += 1
switch s.status {
case Pristine:
s.tilePassed += 1
case Failed:
message = "FAIL"
s.tileFailed += 1
case Aborted:
message = "ABORT"
s.tileAborted += 1
case Panicked:
message = "PANIC"
s.tilePanicked += 1
}
// summarize the failures
if s.status != Pristine {
info := strings.Join(s.failInfo, "; ")

word := ""
switch s.status {
case Failed:
word = "FAIL"
case Aborted:
word = "ABORT"
case Panicked:
word = "PANIC"
}

message := fmt.Sprintf("%s[slab: %s][%d]: %s", word, slab.GetLocation(), index, info)

s.failureReport = append(s.failureReport, message)
}

message = fmt.Sprintf("%s[slab: %s]: %s", message, slabInfo, info)

s.failureReport = append(s.failureReport, message)
}

// Nodule End
}

duration := time.Since(startTime)
Expand All @@ -119,8 +118,8 @@ func Run(t *testing.T, boxFunction BoxFunction, fileSlice []File) {
log.Printf(
"Ran %d tiles in %v\n"+
"%s -- %d Passed | %d Failed | %d Aborted | %d Panicked",
s.slabCount, duration,
outcome, s.slabPassed, s.slabFailed, s.slabAborted, s.slabPanicked,
s.tileCount, duration,
outcome, s.tilePassed, s.tileFailed, s.tileAborted, s.tilePanicked,
)
}

Expand Down
10 changes: 5 additions & 5 deletions go/specimen/structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ const (
// run of a slab to the next
type S struct {
T *testing.T
slabCount int
slabPassed int
slabFailed int
slabAborted int
slabPanicked int
tileCount int
tilePassed int
tileFailed int
tileAborted int
tilePanicked int
failureReport []string

// The below values are reset for each slab
Expand Down

0 comments on commit 3937599

Please sign in to comment.