From 555e2aaa8f34ac18872b5f71533d3ed1be27500d Mon Sep 17 00:00:00 2001 From: Sky Johnson Date: Wed, 30 Jul 2025 08:06:13 -0500 Subject: [PATCH] fix parser test types --- internal/packets/parser/parser_test.go | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/packets/parser/parser_test.go b/internal/packets/parser/parser_test.go index ec3ecfe..5d84e9b 100644 --- a/internal/packets/parser/parser_test.go +++ b/internal/packets/parser/parser_test.go @@ -29,8 +29,8 @@ func TestBasicParsing(t *testing.T) { t.Errorf("Expected 3 fields, got %d", len(packet.Fields)) } - if packet.Fields["player_id"].Type != common.TypeInt32 { - t.Error("player_id should be TypeInt32") + if packet.Fields["player_id"].Type != common.TypeSInt32 { + t.Error("player_id should be TypeSInt32") } if packet.Fields["player_name"].Type != common.TypeString16 { @@ -117,8 +117,8 @@ func TestType2Support(t *testing.T) { packet := packets["Type2Test"] statValue := packet.Fields["stat_value"] - if statValue.Type != common.TypeInt32 { - t.Error("stat_value primary type should be TypeInt32") + if statValue.Type != common.TypeSInt32 { + t.Error("stat_value primary type should be TypeSInt32") } if statValue.Type2 != common.TypeFloat { t.Error("stat_value type2 should be TypeFloat") @@ -128,8 +128,8 @@ func TestType2Support(t *testing.T) { } anotherField := packet.Fields["another_field"] - if anotherField.Type2 != common.TypeInt32 { - t.Error("another_field type2 should be TypeInt32") + if anotherField.Type2 != common.TypeSInt32 { + t.Error("another_field type2 should be TypeSInt32") } if anotherField.Type2Cond != "" { t.Error("another_field should have empty type2_if") @@ -172,8 +172,8 @@ func TestAdvancedFieldAttributes(t *testing.T) { if hiddenField.AddToStruct { t.Error("hidden_field should not be added to struct") } - if hiddenField.AddType != common.TypeInt16 { - t.Error("hidden_field add_type should be TypeInt16") + if hiddenField.AddType != common.TypeSInt16 { + t.Error("hidden_field add_type should be TypeSInt16") } } @@ -302,8 +302,8 @@ func TestArrayParsing(t *testing.T) { t.Errorf("Expected 2 substruct fields, got %d", len(itemsField.SubDef.Fields)) } - if itemsField.SubDef.Fields["item_id"].Type != common.TypeInt32 { - t.Error("item_id should be TypeInt32") + if itemsField.SubDef.Fields["item_id"].Type != common.TypeSInt32 { + t.Error("item_id should be TypeSInt32") } } @@ -369,7 +369,7 @@ func TestSubstructReference(t *testing.T) { - + @@ -490,11 +490,11 @@ func TestBinaryParsingOversized(t *testing.T) { t.Fatalf("Binary parse failed: %v", err) } - if val := result["normal_value"].(uint16); val != 100 { + if val := result["normal_value"].(int16); val != 100 { t.Errorf("Expected normal_value 100, got %d", val) } - if val := result["oversized_value"].(uint16); val != 1000 { + if val := result["oversized_value"].(int16); val != 1000 { t.Errorf("Expected oversized_value 1000, got %d", val) } } @@ -521,7 +521,7 @@ func TestBinaryParsingType2(t *testing.T) { t.Fatalf("Binary parse failed: %v", err) } - if statType := result1["stat_type"].(uint8); statType != 6 { + if statType := result1["stat_type"].(int8); statType != 6 { t.Errorf("Expected stat_type 6, got %d", statType) } @@ -647,7 +647,7 @@ func TestArrayIndexBinaryParsing(t *testing.T) { // First stat (type=5) should not have percentage field stat1 := stats[0] - if stat1["stat_type"].(uint8) != 5 { + if stat1["stat_type"].(int8) != 5 { t.Errorf("Expected stat_type 5, got %d", stat1["stat_type"]) } if _, hasPercentage := stat1["percentage"]; hasPercentage { @@ -656,7 +656,7 @@ func TestArrayIndexBinaryParsing(t *testing.T) { // Second stat (type=6) should have percentage field stat2 := stats[1] - if stat2["stat_type"].(uint8) != 6 { + if stat2["stat_type"].(int8) != 6 { t.Errorf("Expected stat_type 6, got %d", stat2["stat_type"]) } if percentage, hasPercentage := stat2["percentage"]; !hasPercentage { @@ -726,7 +726,7 @@ func TestTemplateDefinitionAndUsage(t *testing.T) { - +