Skip to content

Commit

Permalink
Added silencer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Falderebet committed Oct 5, 2023
1 parent 5b10e5e commit 2db09f0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/demoinfocs/common/equipment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,26 @@ func TestEquipment_ZoomLevel_EntityNil(t *testing.T) {
assert.Equal(t, ZoomLevel(0), wep.ZoomLevel())
}

func TestEquipment_Not_Silenced(t *testing.T) {
wep := &Equipment{
Type: EqAK47,
Entity: entityWithProperty("m_bSilencerOn", st.PropertyValue{IntVal: 0}),
}

assert.Equal(t, false, wep.Silenced())
}

func TestEquipment_Silenced_On_Off(t *testing.T) {
wep := &Equipment{
Type: EqUSP,
Entity: entityWithProperty("m_bSilencerOn", st.PropertyValue{IntVal: 1}),
}
assert.Equal(t, true, wep.Silenced(), "Weapon should be silenced after the property value has been set to 1.")

wep.Entity = entityWithProperty("m_bSilencerOn", st.PropertyValue{IntVal: 0})
assert.Equal(t, false, wep.Silenced(), "Weapon should not be silenced after the property value has been set to 0.")
}

func TestEquipmentAlternative(t *testing.T) {
assert.Equal(t, EqUSP, EquipmentAlternative(EqP2000))
assert.Equal(t, EqCZ, EquipmentAlternative(EqP250))
Expand Down

0 comments on commit 2db09f0

Please sign in to comment.