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.6.11 tracks/go/exercises/leap/leap_test.go
trackler-2.0.6.10 tracks/go/exercises/leap/leap_test.go
trackler-2.0.6.9 tracks/go/exercises/leap/leap_test.go
trackler-2.0.6.8 tracks/go/exercises/leap/leap_test.go
trackler-2.0.6.7 tracks/go/exercises/leap/leap_test.go
trackler-2.0.6.6 tracks/go/exercises/leap/leap_test.go
trackler-2.0.6.5 tracks/go/exercises/leap/leap_test.go
trackler-2.0.6.4 tracks/go/exercises/leap/leap_test.go
trackler-2.0.6.3 tracks/go/exercises/leap/leap_test.go
trackler-2.0.6.2 tracks/go/exercises/leap/leap_test.go
trackler-2.0.6.1 tracks/go/exercises/leap/leap_test.go
trackler-2.0.6.0 tracks/go/exercises/leap/leap_test.go
trackler-2.0.5.18 tracks/go/exercises/leap/leap_test.go
trackler-2.0.5.17 tracks/go/exercises/leap/leap_test.go
trackler-2.0.5.16 tracks/go/exercises/leap/leap_test.go
trackler-2.0.5.15 tracks/go/exercises/leap/leap_test.go
trackler-2.0.5.14 tracks/go/exercises/leap/leap_test.go
trackler-2.0.5.13 tracks/go/exercises/leap/leap_test.go
trackler-2.0.5.12 tracks/go/exercises/leap/leap_test.go
trackler-2.0.5.11 tracks/go/exercises/leap/leap_test.go