~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

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(hmacNewTests, hmacnew)
9
 
}
10
 
 
11
 
var hmacNewTests = []testCase{
12
 
        {
13
 
                Name: "hmacnew.0",
14
 
                In: `package main
15
 
 
16
 
import "crypto/hmac"
17
 
 
18
 
var f = hmac.NewSHA1([]byte("some key"))
19
 
`,
20
 
                Out: `package main
21
 
 
22
 
import (
23
 
        "crypto/hmac"
24
 
        "crypto/sha1"
25
 
)
26
 
 
27
 
var f = hmac.New(sha1.New, []byte("some key"))
28
 
`,
29
 
        },
30
 
        {
31
 
                Name: "hmacnew.1",
32
 
                In: `package main
33
 
 
34
 
import "crypto/hmac"
35
 
 
36
 
var key = make([]byte, 8)
37
 
var f = hmac.NewSHA1(key)
38
 
`,
39
 
                Out: `package main
40
 
 
41
 
import (
42
 
        "crypto/hmac"
43
 
        "crypto/sha1"
44
 
)
45
 
 
46
 
var key = make([]byte, 8)
47
 
var f = hmac.New(sha1.New, key)
48
 
`,
49
 
        },
50
 
        {
51
 
                Name: "hmacnew.2",
52
 
                In: `package main
53
 
 
54
 
import "crypto/hmac"
55
 
 
56
 
var f = hmac.NewMD5([]byte("some key"))
57
 
`,
58
 
                Out: `package main
59
 
 
60
 
import (
61
 
        "crypto/hmac"
62
 
        "crypto/md5"
63
 
)
64
 
 
65
 
var f = hmac.New(md5.New, []byte("some key"))
66
 
`,
67
 
        },
68
 
        {
69
 
                Name: "hmacnew.3",
70
 
                In: `package main
71
 
 
72
 
import "crypto/hmac"
73
 
 
74
 
var f = hmac.NewSHA256([]byte("some key"))
75
 
`,
76
 
                Out: `package main
77
 
 
78
 
import (
79
 
        "crypto/hmac"
80
 
        "crypto/sha256"
81
 
)
82
 
 
83
 
var f = hmac.New(sha256.New, []byte("some key"))
84
 
`,
85
 
        },
86
 
        {
87
 
                Name: "hmacnew.4",
88
 
                In: `package main
89
 
 
90
 
import (
91
 
        "crypto/hmac"
92
 
        "crypto/sha1"
93
 
)
94
 
 
95
 
var f = hmac.New(sha1.New, []byte("some key"))
96
 
`,
97
 
                Out: `package main
98
 
 
99
 
import (
100
 
        "crypto/hmac"
101
 
        "crypto/sha1"
102
 
)
103
 
 
104
 
var f = hmac.New(sha1.New, []byte("some key"))
105
 
`,
106
 
        },
107
 
}