mirror of
https://github.com/lionsoul2014/ip2region.git
synced 2025-12-08 19:25:22 +00:00
30 lines
687 B
Go
30 lines
687 B
Go
// Copyright 2022 The Ip2Region Authors. All rights reserved.
|
|
// Use of this source code is governed by a Apache2.0-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package xdb
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestLoadVectorIndex(t *testing.T) {
|
|
vIndex, err := LoadVectorIndexFromFile("../../../data/ip2region.xdb")
|
|
if err != nil {
|
|
fmt.Printf("failed to load vector index: %s\n", err)
|
|
return
|
|
}
|
|
|
|
fmt.Printf("vIndex length: %d\n", len(vIndex))
|
|
}
|
|
|
|
func TestLoadContent(t *testing.T) {
|
|
buff, err := LoadContentFromFile("../../../data/ip2region.xdb")
|
|
if err != nil {
|
|
fmt.Printf("failed to load xdb content: %s\n", err)
|
|
}
|
|
|
|
fmt.Printf("buff length: %d\n", len(buff))
|
|
}
|