Sha256: 8ee251aacbab8a5baadf91ff5911e2ecd20554b8c4dbb075d5ce30fb7aac8a35

Contents?: true

Size: 943 Bytes

Versions: 122

Compression:

Stored size: 943 Bytes

Contents

package lsproduct

import "testing"

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

122 entries across 122 versions & 1 rubygems

Version Path
trackler-2.2.1.98 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.97 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.96 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.95 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.94 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.93 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.92 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.91 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.90 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.89 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.88 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.87 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.86 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.85 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.84 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.83 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.82 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.81 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.80 tracks/go/exercises/largest-series-product/largest_series_product_test.go
trackler-2.2.1.79 tracks/go/exercises/largest-series-product/largest_series_product_test.go