~ubuntu-branches/ubuntu/saucy/golang/saucy

« back to all changes in this revision

Viewing changes to src/cmd/fix/hashsum_test.go

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2013-07-08 05:52:37 UTC
  • mfrom: (29.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130708055237-at01839e0hp8z3ni
Tags: 2:1.1-1ubuntu1
016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright 2011 The Go Authors.  All rights reserved.
2
 
// Use of this source code is governed by a BSD-style
3
 
// license that can be found in the LICENSE file.
4
 
 
5
 
package main
6
 
 
7
 
func init() {
8
 
        addTestCases(hashSumTests, hashSumFn)
9
 
}
10
 
 
11
 
var hashSumTests = []testCase{
12
 
        {
13
 
                Name: "hashsum.0",
14
 
                In: `package main
15
 
 
16
 
import "crypto/sha256"
17
 
 
18
 
func f() []byte {
19
 
        h := sha256.New()
20
 
        return h.Sum()
21
 
}
22
 
`,
23
 
                Out: `package main
24
 
 
25
 
import "crypto/sha256"
26
 
 
27
 
func f() []byte {
28
 
        h := sha256.New()
29
 
        return h.Sum(nil)
30
 
}
31
 
`,
32
 
        },
33
 
 
34
 
        {
35
 
                Name: "hashsum.1",
36
 
                In: `package main
37
 
 
38
 
func f(h hash.Hash) []byte {
39
 
        return h.Sum()
40
 
}
41
 
`,
42
 
                Out: `package main
43
 
 
44
 
func f(h hash.Hash) []byte {
45
 
        return h.Sum(nil)
46
 
}
47
 
`,
48
 
        },
49
 
 
50
 
        {
51
 
                Name: "hashsum.0",
52
 
                In: `package main
53
 
 
54
 
import "crypto/sha256"
55
 
 
56
 
func f() []byte {
57
 
        h := sha256.New()
58
 
        h.Write([]byte("foo"))
59
 
        digest := h.Sum()
60
 
}
61
 
`,
62
 
                Out: `package main
63
 
 
64
 
import "crypto/sha256"
65
 
 
66
 
func f() []byte {
67
 
        h := sha256.New()
68
 
        h.Write([]byte("foo"))
69
 
        digest := h.Sum(nil)
70
 
}
71
 
`,
72
 
        },
73
 
 
74
 
        {
75
 
                Name: "hashsum.0",
76
 
                In: `package main
77
 
 
78
 
import _ "crypto/sha256"
79
 
import "crypto"
80
 
 
81
 
func f() []byte {
82
 
        hashType := crypto.SHA256
83
 
        h := hashType.New()
84
 
        digest := h.Sum()
85
 
}
86
 
`,
87
 
                Out: `package main
88
 
 
89
 
import _ "crypto/sha256"
90
 
import "crypto"
91
 
 
92
 
func f() []byte {
93
 
        hashType := crypto.SHA256
94
 
        h := hashType.New()
95
 
        digest := h.Sum(nil)
96
 
}
97
 
`,
98
 
        },
99
 
}