Sha256: 14db81196dd807eca72f44238ff1e65053eadce5e4e2245945656c48451c805c

Contents?: true

Size: 1.11 KB

Versions: 158

Compression:

Stored size: 1.11 KB

Contents

package lsproduct

import "testing"

const targetTestVersion = 4

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

func TestLargestSeriesProduct(t *testing.T) {
	for _, test := range tests {
		p, err := LargestSeriesProduct(test.digits, test.span)
		if test.ok {
			// we do not expect error
			if err != nil {
				t.Fatalf("LargestSeriesProduct(%s, %d) returned error %q.  "+
					"Error not expected.",
					test.digits, test.span, err)
			}

			if int64(p) != test.product {
				t.Fatalf("LargestSeriesProduct(%s, %d) = %d, want %d",
					test.digits, test.span, p, test.product)
			}
		} else { // expect error
			// check if err is of error type
			var _ error = err

			// we expect error
			if err == nil {
				t.Fatalf("LargestSeriesProduct(%s, %d) = %d, %v."+
					"  Expected error got nil",
					test.digits, test.span, p, err)
			}
		}
	}
}

func BenchmarkLargestSeriesProduct(b *testing.B) {
	for i := 0; i < b.N; i++ {
		for _, test := range tests {
			LargestSeriesProduct(test.digits, test.span)
		}
	}
}

Version data entries

158 entries across 158 versions & 1 rubygems

Version Path
trackler-2.1.0.2 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.1.0.1 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.1.0.0 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.55 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.54 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.53 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.52 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.51 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.50 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.49 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.48 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.47 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.46 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.45 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.44 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.43 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.42 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.41 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.40 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.0.8.39 tracks/go/exercises/largest-series-product/largest_series_product_test.go