...
1
2
3
4
5 package teststructs
6
7 import (
8 "sync"
9
10 pb "github.com/google/go-cmp/cmp/internal/testprotos"
11 )
12
13
14
15
41
42 type FakeMutex struct {
43 sync.Locker
44 x struct{}
45 }
46
47 type Dirt struct {
48 table Table
49 ts Timestamp
50 Discord DiscordState
51 Proto pb.Dirt
52 wizard map[string]*pb.Wizard
53 sadistic map[string]*pb.Sadistic
54 lastTime int64
55 mu FakeMutex
56 }
57
58 type DiscordState int
59
60 type Timestamp int64
61
62 func (d *Dirt) SetTable(t Table) { d.table = t }
63 func (d *Dirt) SetTimestamp(t Timestamp) { d.ts = t }
64 func (d *Dirt) SetWizard(m map[string]*pb.Wizard) { d.wizard = m }
65 func (d *Dirt) SetSadistic(m map[string]*pb.Sadistic) { d.sadistic = m }
66 func (d *Dirt) SetLastTime(t int64) { d.lastTime = t }
67
68 type Table interface {
69 Operation1() error
70 Operation2() error
71 Operation3() error
72 }
73
74 type MockTable struct {
75 state []string
76 }
77
78 func CreateMockTable(s []string) *MockTable { return &MockTable{s} }
79 func (mt *MockTable) Operation1() error { return nil }
80 func (mt *MockTable) Operation2() error { return nil }
81 func (mt *MockTable) Operation3() error { return nil }
82 func (mt *MockTable) State() []string { return mt.state }
83
View as plain text