Skip to content

Commit 2db09f0

Browse files
committed
Added silencer tests
1 parent 5b10e5e commit 2db09f0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pkg/demoinfocs/common/equipment_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,26 @@ func TestEquipment_ZoomLevel_EntityNil(t *testing.T) {
156156
assert.Equal(t, ZoomLevel(0), wep.ZoomLevel())
157157
}
158158

159+
func TestEquipment_Not_Silenced(t *testing.T) {
160+
wep := &Equipment{
161+
Type: EqAK47,
162+
Entity: entityWithProperty("m_bSilencerOn", st.PropertyValue{IntVal: 0}),
163+
}
164+
165+
assert.Equal(t, false, wep.Silenced())
166+
}
167+
168+
func TestEquipment_Silenced_On_Off(t *testing.T) {
169+
wep := &Equipment{
170+
Type: EqUSP,
171+
Entity: entityWithProperty("m_bSilencerOn", st.PropertyValue{IntVal: 1}),
172+
}
173+
assert.Equal(t, true, wep.Silenced(), "Weapon should be silenced after the property value has been set to 1.")
174+
175+
wep.Entity = entityWithProperty("m_bSilencerOn", st.PropertyValue{IntVal: 0})
176+
assert.Equal(t, false, wep.Silenced(), "Weapon should not be silenced after the property value has been set to 0.")
177+
}
178+
159179
func TestEquipmentAlternative(t *testing.T) {
160180
assert.Equal(t, EqUSP, EquipmentAlternative(EqP2000))
161181
assert.Equal(t, EqCZ, EquipmentAlternative(EqP250))

0 commit comments

Comments
 (0)