File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 1717package rawdb_test
1818
1919import (
20+ "fmt"
21+
2022 "github.com/ava-labs/libevm/common"
2123 // To ensure that all methods are available to importing packages, this test
2224 // is defined in package `rawdb_test` instead of `rawdb`.
@@ -26,15 +28,17 @@ import (
2628// ExampleDatabaseStat demonstrates the method signatures of DatabaseStat, which
2729// exposes an otherwise unexported type that won't have its methods documented.
2830func ExampleDatabaseStat () {
29- var (
30- stat rawdb.DatabaseStat
31- size common.StorageSize
32- )
31+ var stat rawdb.DatabaseStat
32+
33+ stat .Add (common .StorageSize (0 )) // only to demonstrate param type
34+ stat .Add (1 )
35+ stat .Add (2 )
36+ stat .Add (4 )
3337
34- stat .Add (size )
38+ fmt .Println ("Sum:" , stat .Size ()) // sum of all values passed to Add()
39+ fmt .Println ("Count:" , stat .Count ()) // number of calls to Add()
3540
36- var (
37- _ string = stat .Size () // sum of all values passed to Add()
38- _ string = stat .Count () // number of calls to Add()
39- )
41+ // Output:
42+ // Sum: 7.00 B
43+ // Count: 4
4044}
You can’t perform that action at this time.
0 commit comments