Skip to content

Commit 4e4cf4b

Browse files
committed
added more testdata
1 parent 8c49dc5 commit 4e4cf4b

File tree

4 files changed

+85
-2
lines changed

4 files changed

+85
-2
lines changed

testdata/.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
slices
2-
strings
2+
strings
3+
functions
4+
struct

testdata/Makefile

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
all: strings slices
1+
all: strings slices structs functions
22

33
slices: slices.go
44
GOOS=linux go build -gcflags '-N -l' slices.go
55

66
strings: strings.go
77
GOOS=linux go build -gcflags '-N -l' strings.go
88

9+
structs: structs.go
10+
GOOS=linux go build -gcflags '-N -l' structs.go
11+
12+
13+
functions: functions.go
14+
GOOS=linux go build -gcflags '-N -l' functions.go

testdata/functions.go

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
)
7+
8+
func main() {
9+
A0r0()
10+
A1r0(0)
11+
A4r0(0, 1, 2, 3)
12+
one := A0r1()
13+
a, b, c, d := A0r4()
14+
e, f := A2r2(0, 1)
15+
16+
if a+b+c+d+e+f+one == 0 {
17+
os.Exit(1)
18+
}
19+
os.Exit(2)
20+
}
21+
22+
func A0r0() {
23+
fmt.Println("A0r0")
24+
}
25+
26+
func A1r0(a int) {
27+
fmt.Println("A1r0", a)
28+
}
29+
30+
func A0r1() int {
31+
fmt.Println("A0r1")
32+
return 0xaaaa
33+
}
34+
35+
func A4r0(a, b, c, d int) {
36+
fmt.Println("A4r0", a, b, c, d)
37+
}
38+
39+
func A0r4() (int, int, int, int) {
40+
fmt.Println("A0R4")
41+
return 1, 2, 3, 4
42+
}
43+
44+
func A2r2(a, b int) (int, int) {
45+
fmt.Println("A2R2", a, b)
46+
return 1, 2
47+
}

testdata/structs.go

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package main
2+
3+
import "fmt"
4+
5+
type AStruct struct {
6+
PublicField int
7+
privateField int
8+
}
9+
10+
func (a *AStruct) GetPub() int {
11+
return a.PublicField
12+
}
13+
14+
func (a *AStruct) GetPriv() int {
15+
return a.privateField
16+
}
17+
18+
func Create() *AStruct {
19+
return &AStruct{
20+
PublicField: 0xaaaa,
21+
privateField: 0xbbbb,
22+
}
23+
}
24+
25+
func main() {
26+
a := Create()
27+
fmt.Println("%d %d", a.GetPriv(), a.privateField)
28+
}

0 commit comments

Comments
 (0)