Repository navigation
Expand file tree
/
Copy pathtypes.go
More file actions
109 lines (94 loc) · 1.7 KB
/
Copy pathtypes.go
File metadata and controls
109 lines (94 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package main
type Choice struct {
Type string
Node string
From string
To string
Op string
Step int
MaxMessages int
}
func (c Choice) Copy() Choice {
return Choice{
Type: c.Type,
Node: c.Node,
From: c.From,
To: c.To,
Op: c.Op,
Step: c.Step,
MaxMessages: c.MaxMessages,
}
}
type Trace struct {
Choices []Choice
}
func (t *Trace) Copy() *Trace {
new := &Trace{
Choices: make([]Choice, len(t.Choices)),
}
for i, ch := range t.Choices {
new.Choices[i] = ch.Copy()
}
return new
}
func NewTrace() *Trace {
return &Trace{
Choices: make([]Choice, 0),
}
}
func (t *Trace) Add(ch Choice) {
t.Choices = append(t.Choices, ch.Copy())
}
type Event struct {
Name string
Node string `json:"-"`
Params map[string]interface{}
Reset bool
}
func (e Event) Copy() Event {
new := Event{
Name: e.Name,
Node: e.Node,
Params: make(map[string]interface{}),
Reset: e.Reset,
}
for k, v := range e.Params {
new.Params[k] = v
}
return new
}
type EventTrace struct {
Events []Event
}
func NewEventTrace() *EventTrace {
return &EventTrace{
Events: make([]Event, 0),
}
}
func (e *EventTrace) Copy() *EventTrace {
new := &EventTrace{
Events: make([]Event, len(e.Events)),
}
for i, e := range e.Events {
new.Events[i] = e.Copy()
}
return new
}
func (et *EventTrace) Add(e Event) {
et.Events = append(et.Events, e.Copy())
}
// type eventTrace struct {
// Nodes map[string]*eventNode
// }
// type eventNode struct {
// Event
// Node int
// Prev string
// ID string `json:"-"`
// }
type Stats struct {
Coverages []int
// TimeStamps []time.Duration
RandomTraces int
MutatedTraces int
}