-
Notifications
You must be signed in to change notification settings - Fork 0
/
cases_test.go
64 lines (62 loc) · 1.09 KB
/
cases_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package grains
// Source: exercism/problem-specifications
// Commit: 2ec42ab Grains: Fixed canonical data to have standard error indicator (#1322)
// Problem Specifications Version: 1.2.0
// returns the number of grains on the square
var squareTests = []struct {
description string
input int
expectedVal uint64
expectError bool
}{
{
description: "1",
input: 1,
expectedVal: 1,
},
{
description: "2",
input: 2,
expectedVal: 2,
},
{
description: "3",
input: 3,
expectedVal: 4,
},
{
description: "4",
input: 4,
expectedVal: 8,
},
{
description: "16",
input: 16,
expectedVal: 32768,
},
{
description: "32",
input: 32,
expectedVal: 2147483648,
},
{
description: "64",
input: 64,
expectedVal: 9223372036854775808,
},
{
description: "square 0 returns an error",
input: 0,
expectError: true,
},
{
description: "negative square returns an error",
input: -1,
expectError: true,
},
{
description: "square greater than 64 returns an error",
input: 65,
expectError: true,
},
}