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

« back to all changes in this revision

Viewing changes to src/cmd/fix/strconv_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(strconvTests, strconvFn)
9
 
}
10
 
 
11
 
var strconvTests = []testCase{
12
 
        {
13
 
                Name: "strconv.0",
14
 
                In: `package main
15
 
 
16
 
import "strconv"
17
 
 
18
 
func f() {
19
 
        foo.Atob("abc")
20
 
 
21
 
        strconv.Atob("true")
22
 
        strconv.Btoa(false)
23
 
 
24
 
        strconv.Atof32("1.2")
25
 
        strconv.Atof64("1.2")
26
 
        strconv.AtofN("1.2", 64)
27
 
        strconv.Ftoa32(1.2, 'g', 17)
28
 
        strconv.Ftoa64(1.2, 'g', 17)
29
 
        strconv.FtoaN(1.2, 'g', 17, 64)
30
 
 
31
 
        strconv.Atoi("3")
32
 
        strconv.Atoi64("3")
33
 
        strconv.Btoi64("1234", 5)
34
 
 
35
 
        strconv.Atoui("3")
36
 
        strconv.Atoui64("3")
37
 
        strconv.Btoui64("1234", 5)
38
 
 
39
 
        strconv.Itoa(123)
40
 
        strconv.Itoa64(1234)
41
 
        strconv.Itob(123, 5)
42
 
        strconv.Itob64(1234, 5)
43
 
 
44
 
        strconv.Uitoa(123)
45
 
        strconv.Uitoa64(1234)
46
 
        strconv.Uitob(123, 5)
47
 
        strconv.Uitob64(1234, 5)
48
 
 
49
 
        strconv.Uitoa(uint(x))
50
 
        strconv.Uitoa(f(x))
51
 
}
52
 
`,
53
 
                Out: `package main
54
 
 
55
 
import "strconv"
56
 
 
57
 
func f() {
58
 
        foo.Atob("abc")
59
 
 
60
 
        strconv.ParseBool("true")
61
 
        strconv.FormatBool(false)
62
 
 
63
 
        strconv.ParseFloat("1.2", 32)
64
 
        strconv.ParseFloat("1.2", 64)
65
 
        strconv.ParseFloat("1.2", 64)
66
 
        strconv.FormatFloat(float64(1.2), 'g', 17, 32)
67
 
        strconv.FormatFloat(1.2, 'g', 17, 64)
68
 
        strconv.FormatFloat(1.2, 'g', 17, 64)
69
 
 
70
 
        strconv.Atoi("3")
71
 
        strconv.ParseInt("3", 10, 64)
72
 
        strconv.ParseInt("1234", 5, 64)
73
 
 
74
 
        strconv.ParseUint("3", 10, 0)
75
 
        strconv.ParseUint("3", 10, 64)
76
 
        strconv.ParseUint("1234", 5, 64)
77
 
 
78
 
        strconv.Itoa(123)
79
 
        strconv.FormatInt(1234, 10)
80
 
        strconv.FormatInt(int64(123), 5)
81
 
        strconv.FormatInt(1234, 5)
82
 
 
83
 
        strconv.FormatUint(uint64(123), 10)
84
 
        strconv.FormatUint(1234, 10)
85
 
        strconv.FormatUint(uint64(123), 5)
86
 
        strconv.FormatUint(1234, 5)
87
 
 
88
 
        strconv.FormatUint(uint64(x), 10)
89
 
        strconv.FormatUint(uint64(f(x)), 10)
90
 
}
91
 
`,
92
 
        },
93
 
}