66
77 "github.com/stretchr/testify/assert"
88
9- "github.com/markus-wa/demoinfocs-golang/sendtables"
10- "github.com/markus-wa/demoinfocs-golang/sendtables/fake"
9+ st "github.com/markus-wa/demoinfocs-golang/sendtables"
1110)
1211
1312func TestPlayerActiveWeapon (t * testing.T ) {
@@ -125,7 +124,7 @@ func TestPlayer_FlashDurationTimeRemaining_Fallback(t *testing.T) {
125124}
126125
127126func TestPlayer_IsSpottedBy_HasSpotted_True (t * testing.T ) {
128- pl := playerWithProperty ("m_bSpottedByMask.000" , sendtables .PropertyValue {IntVal : 2 })
127+ pl := playerWithProperty ("m_bSpottedByMask.000" , st .PropertyValue {IntVal : 2 })
129128 pl .EntityID = 1
130129
131130 other := newPlayer (0 )
@@ -136,7 +135,7 @@ func TestPlayer_IsSpottedBy_HasSpotted_True(t *testing.T) {
136135}
137136
138137func TestPlayer_IsSpottedBy_HasSpotted_False (t * testing.T ) {
139- pl := playerWithProperty ("m_bSpottedByMask.000" , sendtables .PropertyValue {IntVal : 0 })
138+ pl := playerWithProperty ("m_bSpottedByMask.000" , st .PropertyValue {IntVal : 0 })
140139 pl .EntityID = 1
141140
142141 other := newPlayer (0 )
@@ -147,7 +146,7 @@ func TestPlayer_IsSpottedBy_HasSpotted_False(t *testing.T) {
147146}
148147
149148func TestPlayer_IsSpottedBy_HasSpotted_BitOver32 (t * testing.T ) {
150- pl := playerWithProperty ("m_bSpottedByMask.001" , sendtables .PropertyValue {IntVal : 1 })
149+ pl := playerWithProperty ("m_bSpottedByMask.001" , st .PropertyValue {IntVal : 1 })
151150 pl .EntityID = 1
152151
153152 other := newPlayer (0 )
@@ -168,25 +167,25 @@ func TestPlayer_IsSpottedBy_EntityNull(t *testing.T) {
168167}
169168
170169func TestPlayer_IsInBombZone (t * testing.T ) {
171- pl := playerWithProperty ("m_bInBombZone" , sendtables .PropertyValue {IntVal : 1 })
170+ pl := playerWithProperty ("m_bInBombZone" , st .PropertyValue {IntVal : 1 })
172171
173172 assert .True (t , pl .IsInBombZone ())
174173}
175174
176175func TestPlayer_IsInBuyZone (t * testing.T ) {
177- pl := playerWithProperty ("m_bInBuyZone" , sendtables .PropertyValue {IntVal : 1 })
176+ pl := playerWithProperty ("m_bInBuyZone" , st .PropertyValue {IntVal : 1 })
178177
179178 assert .True (t , pl .IsInBuyZone ())
180179}
181180
182181func TestPlayer_IsWalking (t * testing.T ) {
183- pl := playerWithProperty ("m_bIsWalking" , sendtables .PropertyValue {IntVal : 1 })
182+ pl := playerWithProperty ("m_bIsWalking" , st .PropertyValue {IntVal : 1 })
184183
185184 assert .True (t , pl .IsWalking ())
186185}
187186
188187func TestPlayer_IsScoped (t * testing.T ) {
189- pl := playerWithProperty ("m_bIsScoped" , sendtables .PropertyValue {IntVal : 1 })
188+ pl := playerWithProperty ("m_bIsScoped" , st .PropertyValue {IntVal : 1 })
190189
191190 assert .True (t , pl .IsScoped ())
192191}
@@ -195,31 +194,6 @@ func newPlayer(tick int) *Player {
195194 return NewPlayer (mockDemoInfoProvider (128 , tick ))
196195}
197196
198- type demoInfoProviderMock struct {
199- tickRate float64
200- ingameTick int
201- }
202-
203- func (p demoInfoProviderMock ) TickRate () float64 {
204- return p .tickRate
205- }
206-
207- func (p demoInfoProviderMock ) IngameTick () int {
208- return p .ingameTick
209- }
210-
211- func mockDemoInfoProvider (tickRate float64 , tick int ) demoInfoProvider {
212- return demoInfoProviderMock {
213- tickRate : tickRate ,
214- ingameTick : tick ,
215- }
216- }
217-
218- func playerWithProperty (propName string , value sendtables.PropertyValue ) * Player {
219- entity := new (fake.Entity )
220- prop := new (fake.Property )
221- prop .On ("Value" ).Return (value )
222- entity .On ("FindPropertyI" , propName ).Return (prop )
223- pl := & Player {Entity : entity }
224- return pl
197+ func playerWithProperty (propName string , value st.PropertyValue ) * Player {
198+ return & Player {Entity : entityWithProperty (propName , value )}
225199}
0 commit comments