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:
Houmgaor
2026-02-02 11:02:52 +01:00
parent 21a66841ab
commit dad6a23bba
10 changed files with 3040 additions and 0 deletions

View File

@@ -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()))
}
}