github.com/TeaOSLab/EdgeNode@v1.3.8/internal/rpc/call_stat_test.go (about)

     1  // Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
     2  
     3  package rpc_test
     4  
     5  import (
     6  	"github.com/TeaOSLab/EdgeNode/internal/rpc"
     7  	"testing"
     8  )
     9  
    10  func TestNewCallStat(t *testing.T) {
    11  	var stat = rpc.NewCallStat(10)
    12  	stat.Add(true, 1)
    13  	stat.Add(true, 2)
    14  	stat.Add(true, 3)
    15  	stat.Add(false, 4)
    16  	stat.Add(true, 0)
    17  	stat.Add(true, 1)
    18  	t.Log(stat.Sum())
    19  }