1
0
mirror of https://github.com/fumiama/unibase2n.git synced 2026-06-12 21:20:25 +08:00

finish dec128blk1

This commit is contained in:
源文雨
2022-10-01 15:30:15 +08:00
parent 08228b7a61
commit aff58aa75e
5 changed files with 113 additions and 3 deletions

22
decode_test.go Normal file
View File

@@ -0,0 +1,22 @@
package unibase2n
import (
"math/rand"
"testing"
"github.com/stretchr/testify/assert"
)
func TestDec128blk1(t *testing.T) {
var in, tmp [32]byte
_, err := rand.Read(in[:])
if err != nil {
t.Fatal(err)
}
n, _ := Base{bit: 1}.EncodeLen(32)
out := make([]byte, n)
enc16blk1(0x2333, in[:], out)
t.Log(out)
dec128blk1(uint128be{0x2333233323332333, 0x2333233323332333}, out[:], tmp[:])
assert.Equal(t, in, tmp)
}