-
Notifications
You must be signed in to change notification settings - Fork 3
/
core_test.go
24 lines (22 loc) · 862 Bytes
/
core_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package core
import (
"fmt"
"github.com/ryogrid/nostrp2p/glo_val"
"github.com/ryogrid/nostrp2p/np2p_util"
"strconv"
"testing"
)
func TestGzipCompressLateSurveyMsgPack(t *testing.T) {
hexPubKeyStr := "09f7437e5ad50770222a9d158fb5a0e947ca4089ef4b07e8ede374d7302d8daf"
glo_val.SelfPubkey64bit = np2p_util.GetUint64FromHexPubKeyStr(hexPubKeyStr)
dman := NewNutsDBDataManager()
allEvents := dman.GetLatestEvents(0, np2p_util.GetCurUnixTimeInSec(), -1)
fmt.Println("allEvents size:" + strconv.Itoa(len(*allEvents)))
allEventsBytes := make([]byte, 0)
for _, evt := range *allEvents {
allEventsBytes = append(allEventsBytes, evt.Encode()...)
}
fmt.Println("allEventsBytes size:" + strconv.Itoa(len(allEventsBytes)))
compressedBytes := np2p_util.GzipCompless(allEventsBytes)
fmt.Println("compressedBytes size:" + strconv.Itoa(len(compressedBytes)))
}