forked from p53841790/wheat-cache
test(structure-val): add perf test
This commit is contained in:
parent
0f1142d434
commit
2ed75832ba
|
@ -1,6 +1,7 @@
|
|||
package structure
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
|
@ -126,4 +127,20 @@ func TestValue_SetByte(t *testing.T) {
|
|||
v, err = value.GetByte(10001)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, v, true)
|
||||
require.Equal(t, value.GetSize(), (10001/8)+1+16)
|
||||
}
|
||||
|
||||
func TestValue_SetByteWei(t *testing.T) {
|
||||
k := make([]byte, 100)
|
||||
offset := 700
|
||||
k[offset/8] = 0b00000001
|
||||
k[offset/8] |= 0b1 << (offset % 8)
|
||||
|
||||
fmt.Printf("%b\n", k[offset/8])
|
||||
|
||||
fmt.Printf("%v", (k[offset/8]&(0b1<<(offset%8))) != 0)
|
||||
|
||||
k[offset/8] ^= 0b1 << (offset % 8)
|
||||
|
||||
fmt.Printf("%v", (k[offset/8]&(0b1<<(offset%8))) != 0)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue