Sha256: df8e07112c9e230eb50f9c5877404fd8a59e7b8ac5f0d58bf1d0bca9051911d9

Contents?: true

Size: 763 Bytes

Versions: 67

Compression:

Stored size: 763 Bytes

Contents

package leap

import "testing"

// Define a function IsLeapYear(int) bool.
//
// Also define a testVersion with a value that matches
// the targetTestVersion here.

const targetTestVersion = 2

func TestLeapYears(t *testing.T) {
	if testVersion != targetTestVersion {
		t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
	}
	for _, test := range testCases {
		observed := IsLeapYear(test.year)
		if observed != test.expected {
			t.Fatalf("IsLeapYear(%d) = %t, want %t (%s)",
				test.year, observed, test.expected, test.description)
		}
	}
}

// Benchmark 400 year interval to get fair weighting of different years.
func Benchmark400(b *testing.B) {
	for i := 0; i < b.N; i++ {
		for y := 1600; y < 2000; y++ {
			IsLeapYear(y)
		}
	}
}

Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
trackler-2.0.3.1 tracks/go/exercises/leap/leap_test.go
trackler-2.0.3.0 tracks/go/exercises/leap/leap_test.go
trackler-2.0.2.0 tracks/go/exercises/leap/leap_test.go
trackler-2.0.1.2 tracks/go/exercises/leap/leap_test.go
trackler-2.0.1.1 tracks/go/exercises/leap/leap_test.go
trackler-2.0.1.0 tracks/go/exercises/leap/leap_test.go
trackler-2.0.0.10 tracks/go/exercises/leap/leap_test.go
trackler-2.0.0.9 tracks/go/exercises/leap/leap_test.go
trackler-2.0.0.8 tracks/go/exercises/leap/leap_test.go
trackler-2.0.0.7 tracks/go/exercises/leap/leap_test.go
trackler-2.0.0.6 tracks/go/exercises/leap/leap_test.go
trackler-2.0.0.5 tracks/go/exercises/leap/leap_test.go
trackler-2.0.0.4 tracks/go/exercises/leap/leap_test.go
trackler-2.0.0.3 tracks/go/exercises/leap/leap_test.go
trackler-2.0.0.2 tracks/go/exercises/leap/leap_test.go
trackler-2.0.0.1 tracks/go/exercises/leap/leap_test.go
trackler-2.0.0.0 tracks/go/exercises/leap/leap_test.go
trackler-1.0.4.1 tracks/go/exercises/leap/leap_test.go
trackler-1.0.4.0 tracks/go/exercises/leap/leap_test.go
trackler-1.0.3.0 tracks/go/exercises/leap/leap_test.go