mirror of
https://github.com/garethgeorge/backrest.git
synced 2025-12-20 04:25:32 +00:00
chore: refactor storage layer
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user