fix parser test types
This commit is contained in:
parent
9c35904ecf
commit
555e2aaa8f
@ -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) {
|
||||
<i32 name="item_id">
|
||||
<str16 name="item_name">
|
||||
</substruct>
|
||||
|
||||
|
||||
<packet name="SubstructTest">
|
||||
<version number="1">
|
||||
<i8 name="count">
|
||||
@ -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) {
|
||||
<f32 name="x,y,z">
|
||||
<f32 name="heading">
|
||||
</template>
|
||||
|
||||
|
||||
<template name="appearance">
|
||||
<color name="skin_color,hair_color,eye_color">
|
||||
<str16 name="face_file,hair_file">
|
||||
@ -742,7 +742,7 @@ func TestTemplateDefinitionAndUsage(t *testing.T) {
|
||||
<str16 name="guild_name" if="flag:has_guild">
|
||||
</version>
|
||||
</packet>
|
||||
|
||||
|
||||
<!-- Test template with group prefix -->
|
||||
<packet name="GroupedTemplate">
|
||||
<version number="1">
|
||||
|
Loading…
x
Reference in New Issue
Block a user