mirror of
https://github.com/bestnite/sub2sing-box.git
synced 2025-10-25 16:51:01 +00:00
22 lines
379 B
Go
22 lines
379 B
Go
package test
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"log"
|
|
"testing"
|
|
|
|
"github.com/sagernet/sing/common/byteformats"
|
|
)
|
|
|
|
func TestUnmarshalNetworkBytesCompact(t *testing.T) {
|
|
up := &byteformats.NetworkBytesCompat{}
|
|
upmbps := "100 Mbps"
|
|
err := json.Unmarshal(fmt.Appendf(nil, `"%s"`, upmbps), up)
|
|
if err != nil {
|
|
log.Fatalf("error: %v", err)
|
|
return
|
|
}
|
|
log.Printf("%+v", up)
|
|
}
|