This commit is contained in:
Bel LaPointe
2019-02-18 09:31:35 -07:00
commit cbf886fb7e
14 changed files with 1016 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
package packable
import "testing"
func TestPackableString(t *testing.T) {
raw := "hello"
s := NewString(raw)
if s.String() != raw {
t.Errorf("cannot convert string to String: %v vs %v", s, raw)
}
packed, err := s.Encode()
if err != nil {
t.Errorf("cannot encode String: %v", err)
}
x := NewString("")
if err := x.Decode(packed); err != nil {
t.Errorf("cannot decode string: %v", err)
} else if x.String() != raw {
t.Errorf("wrong decoded string: %v vs %v", x, raw)
}
}