Skip to content

Commit

Permalink
Pretty up the output
Browse files Browse the repository at this point in the history
  • Loading branch information
p-offtermatt committed Nov 22, 2023
1 parent 71a3b80 commit c510e61
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions tests/difference/core/quint_model/driver/mbt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ func TestMBT(t *testing.T) {
t.Log("Running trace ", dirEntry.Name())
RunItfTrace(t, "traces/"+dirEntry.Name())
}

t.Log("✅ Running traces from the traces folder done")
t.Log(len(dirEntries), "traces run")
}

func RunItfTrace(t *testing.T, path string) {
Expand Down Expand Up @@ -223,6 +226,7 @@ func RunItfTrace(t *testing.T, path string) {
}
t.Log("Packet queues match")
}
t.Log("🟢 Trace is ok!")
}

func CompareValidatorSets(t *testing.T, driver *Driver, currentModelState map[string]itf.Expr, consumers []string, index int) {
Expand Down Expand Up @@ -329,15 +333,24 @@ func CompareTimes(
// The names in the model validator set are expected to correspond to the monikers in the system validator set.
func CompareValSet(modelValSet map[string]itf.Expr, systemValSet map[string]int64) error {
expectedValSet := make(map[string]int64, len(modelValSet))
// strip away vals with power 0, because they are not always in the system validator set
for val, power := range modelValSet {
// strip away vals with power 0, since they do not appear at all in the system val set
if power.Value.(int64) == 0 {
continue
}
expectedValSet[val] = power.Value.(int64)
}
if !reflect.DeepEqual(expectedValSet, systemValSet) {
return fmt.Errorf("Model validator set %v, system validator set %v", expectedValSet, systemValSet)

actualValSet := make(map[string]int64, len(systemValSet))
for val, power := range systemValSet {
if power == 0 {
continue
}
actualValSet[val] = power
}

if !reflect.DeepEqual(expectedValSet, actualValSet) {
return fmt.Errorf("Model validator set %v, system validator set %v", expectedValSet, actualValSet)
}
return nil
}

0 comments on commit c510e61

Please sign in to comment.