Sha256: 3adeb992538487eafc0f464eb6aaf8ba1f4e4bec60f475ef13194e2fae5232ff

Contents?: true

Size: 746 Bytes

Versions: 122

Compression:

Stored size: 746 Bytes

Contents

package leap

import "testing"

// Define a function with the following signature:
// IsLeapYear(int) bool

const targetTestVersion = 3

func TestTestVersion(t *testing.T) {
	if testVersion != targetTestVersion {
		t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
	}
}

func TestLeapYears(t *testing.T) {
	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

122 entries across 122 versions & 1 rubygems

Version Path
trackler-2.2.0.1 tracks/go/exercises/leap/leap_test.go
trackler-2.2.0.0 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.55 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.54 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.53 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.52 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.51 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.50 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.49 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.48 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.47 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.46 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.45 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.44 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.43 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.42 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.41 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.40 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.39 tracks/go/exercises/leap/leap_test.go
trackler-2.1.0.38 tracks/go/exercises/leap/leap_test.go