chore: refactor storage layer

This commit is contained in:
garethgeorge
2023-11-15 18:14:46 -08:00
parent 4c6f042250
commit b22e006ffb
12 changed files with 271 additions and 121 deletions

View File

@@ -0,0 +1,23 @@
package serializationutil
import "testing"
func TestItoa(t *testing.T) {
nums := []int64{0, 1, 2, 3, 4, 1 << 32, int64(1) << 62}
for _, num := range nums {
b := Itob(num)
if Btoi(b) != num {
t.Errorf("itob/btoi failed for %d", num)
}
}
}
func TestStob(t *testing.T) {
strs := []string{"", "a", "ab", "abc", "abcd", "abcde", "abcdef"}
for _, str := range strs {
b := Stob(str)
if val, _ := Btos(b); val != str {
t.Errorf("stob/btos failed for %s", str)
}
}
}