github.com/qri-io/qri@v0.10.1-0.20220104210721-c771715036cb/config/stats_test.go (about)

     1  package config
     2  
     3  import (
     4  	"reflect"
     5  	"testing"
     6  )
     7  
     8  func TestStatsValidate(t *testing.T) {
     9  	err := DefaultStats().Validate()
    10  	if err != nil {
    11  		t.Errorf("error validating default stats: %s", err)
    12  	}
    13  }
    14  
    15  func TestStatsCopy(t *testing.T) {
    16  	// build off DefaultStats so we can test that the stats Copy
    17  	// actually copies over correctly
    18  	s := DefaultStats()
    19  	cases := []struct {
    20  		stats *Stats
    21  	}{
    22  		{s},
    23  	}
    24  	for i, c := range cases {
    25  		cpy := c.stats.Copy()
    26  		if !reflect.DeepEqual(cpy, c.stats) {
    27  			t.Errorf("Stats Copy test case %v, stats structs are not equal: \ncopy: %v, \noriginal: %v", i, cpy, c.stats)
    28  			continue
    29  		}
    30  	}
    31  }