github.com/status-im/status-go@v1.1.0/protocol/anonmetrics/interval_incrementer_test.go (about)

     1  package anonmetrics
     2  
     3  import "testing"
     4  
     5  func TestFibonacciIntervalIncrementer_Next(t *testing.T) {
     6  	fii := FibonacciIntervalIncrementer{
     7  		Last:    0,
     8  		Current: 1,
     9  	}
    10  
    11  	expected := []int64{
    12  		1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765,
    13  	}
    14  
    15  	for i := 0; i < 19; i++ {
    16  		next := fii.Next()
    17  		if next != expected[i] {
    18  			t.Errorf("expected '%d', received '%d'", expected[i], next)
    19  		}
    20  	}
    21  }