1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-10-01 15:46:17 -04:00

text dictionary: added no-named string check as separated test function

This commit is contained in:
M. Sz 2021-02-28 20:35:35 +01:00
parent 3b41f9e89b
commit b43da8f083

View File

@ -1,8 +1,6 @@
package d2tbl
import (
"fmt"
"testing"
)
@ -25,7 +23,30 @@ func TestTBL_Marshal(t *testing.T) {
t.Error(err)
}
fmt.Println(newTbl)
for key, value := range *tbl {
newValue, ok := newTbl[key]
if !ok {
t.Fatalf("string %s wasn't encoded to table", key)
}
if newValue != value {
t.Fatal("unexpected value set")
}
}
}
func TestTBL_MarshalNoNameString(t *testing.T) {
tbl := &TextDictionary{
"#0": "OKEY",
}
data := tbl.Marshal()
newTbl, err := LoadTextDictionary(data)
if err != nil {
t.Error(err)
}
for key, value := range *tbl {
newValue, ok := newTbl[key]