Sha256: 56b957537b820feff5125a5ae2d325440e3031367e958c1222dde57849ef3c44

Contents?: true

Size: 1.15 KB

Versions: 127

Compression:

Stored size: 1.15 KB

Contents

package luhn

// Source: exercism/x-common
// Commit: c826372 luhn: Make canonical-data.json compliant
// x-common version: 1.0.0

var testCases = []struct {
	description string
	input       string
	ok          bool
}{
	{
		"single digit strings can not be valid",
		"1",
		false,
	},
	{
		"A single zero is invalid",
		"0",
		false,
	},
	{
		"a simple valid SIN that remains valid if reversed",
		"059",
		true,
	},
	{
		"a simple valid SIN that becomes invalid if reversed",
		"59",
		true,
	},
	{
		"a valid Canadian SIN",
		"055 444 285",
		true,
	},
	{
		"invalid Canadian SIN",
		"055 444 286",
		false,
	},
	{
		"invalid credit card",
		"8273 1232 7352 0569",
		false,
	},
	{
		"valid strings with a non-digit included become invalid",
		"055a 444 285",
		false,
	},
	{
		"valid strings with punctuation included become invalid",
		"055-444-285",
		false,
	},
	{
		"valid strings with symbols included become invalid",
		"055£ 444$ 285",
		false,
	},
	{
		"single zero with space is invalid",
		" 0",
		false,
	},
	{
		"more than a single zero is valid",
		"0000 0",
		true,
	},
	{
		"input digit 9 is correctly converted to output digit 9",
		"091",
		true,
	},
}

Version data entries

127 entries across 127 versions & 1 rubygems

Version Path
trackler-2.2.1.56 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.55 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.54 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.53 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.52 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.51 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.50 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.49 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.48 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.47 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.46 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.45 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.44 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.43 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.42 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.41 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.40 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.39 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.38 tracks/go/exercises/luhn/cases_test.go
trackler-2.2.1.37 tracks/go/exercises/luhn/cases_test.go