mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-24 16:43:37 +01:00
test: improve test coverage from 11% to 20%
Add comprehensive tests across multiple packages: - mhfpacket: Add tests for 300+ packet opcodes, system packets, MHF packets, and detailed parsing tests (6.4% -> 38.8%) - timeserver: Add tests for all time functions (0% -> 97.4%) - deltacomp: Add edge case tests for compression functions - entranceserver: Add server creation tests - binpacket: Add mail notify panic test - config: Add Mode.String() tests - signserver: Expand server tests
This commit is contained in:
@@ -399,3 +399,32 @@ func TestMsgBinChatAllTypes(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMsgBinMailNotifyParsePanics(t *testing.T) {
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
t.Error("Parse() should panic with 'implement me'")
|
||||
}
|
||||
}()
|
||||
|
||||
m := MsgBinMailNotify{}
|
||||
bf := byteframe.NewByteFrame()
|
||||
_ = m.Parse(bf)
|
||||
}
|
||||
|
||||
func TestMsgBinMailNotifyBuildLongName(t *testing.T) {
|
||||
m := MsgBinMailNotify{
|
||||
SenderName: "ThisIsAVeryLongPlayerNameThatExceeds21Characters",
|
||||
}
|
||||
|
||||
bf := byteframe.NewByteFrame()
|
||||
err := m.Build(bf)
|
||||
if err != nil {
|
||||
t.Fatalf("Build() error = %v", err)
|
||||
}
|
||||
|
||||
// Data should still be 22 bytes (1 + 21)
|
||||
if len(bf.Data()) != 22 {
|
||||
t.Errorf("Data len = %d, want 22", len(bf.Data()))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user