1
0
mirror of https://github.com/golang/go synced 2024-11-11 20:40:21 -07:00

fix some tests. only 3 remain broken (complit, hilbert, initcomma).

leaving golden.out alone for now.

R=ken
DELTA=13  (0 added, 0 deleted, 13 changed)
OCL=21682
CL=21682
This commit is contained in:
Rob Pike 2008-12-20 13:38:29 -08:00
parent c3077f7606
commit 61a7e44002
9 changed files with 13 additions and 13 deletions

View File

@ -17,7 +17,7 @@ type Vector struct {
func New() *Vector { func New() *Vector {
v := new(*Vector); v := new(*Vector);
v.nelem = 0; v.nelem = 0;
v.elem = new(*[10]Element); v.elem = new([10]Element);
return v; return v;
} }

View File

@ -13,7 +13,7 @@ type T struct {
func main() { func main() {
var ta []*T; var ta []*T;
ta = new(*[1]*T); ta = new([1]*T);
ta[0] = nil; ta[0] = nil;
} }
/* /*

View File

@ -31,7 +31,7 @@ func (s *TStruct) field(i int) *TStruct {
func main() { func main() {
v := new(*Vector); v := new(*Vector);
v.elem = new(*[10]Element); v.elem = new([10]Element);
t := new(*TStruct); t := new(*TStruct);
t.name = "hi"; t.name = "hi";
v.elem[0] = t; v.elem[0] = t;

View File

@ -20,7 +20,7 @@ func P(a []string) string {
func main() { func main() {
m := new(map[string] []string); m := new(map[string] []string);
as := new(*[2]string); as := new([2]string);
as[0] = "0"; as[0] = "0";
as[1] = "1"; as[1] = "1";
m["0"] = as; m["0"] = as;

View File

@ -13,5 +13,5 @@ var c = []int { 1 }
func main() { func main() {
if len(a) != 2 { panicln("len a", len(a)) } if len(a) != 2 { panicln("len a", len(a)) }
if len(b) != 5 { panicln("len b", len(b)) } if len(b) != 5 { panicln("len b", len(b)) }
if len(c) != 1 { panicln("len a", len(a)) } if len(c) != 1 { panicln("len a", len(c)) }
} }

View File

@ -96,10 +96,10 @@ func
testpdpf1() testpdpf1()
{ {
a := new(*[40]int); a := new(*[40]int);
setpd(a); setpd(*a);
res(sumpd(a), 0, 40); res(sumpd(*a), 0, 40);
b := a[5:30]; b := (*a)[5:30];
res(sumpd(b), 5, 30); res(sumpd(b), 5, 30);
} }

View File

@ -139,7 +139,7 @@ func Get() int
c = peekc; c = peekc;
peekc = -1; peekc = -1;
} else { } else {
c = convert(int, input[inputindex]); c = int(input[inputindex]);
inputindex++; inputindex++;
if c == '\n' { if c == '\n' {
lineno = lineno + 1; lineno = lineno + 1;
@ -175,7 +175,7 @@ func NextToken()
break; break;
default: default:
for i = 0; i < 100 - 1; { // sizeof tokenbuf - 1 for i = 0; i < 100 - 1; { // sizeof tokenbuf - 1
tokenbuf[i] = convert(byte, c); tokenbuf[i] = byte(c);
i = i + 1; i = i + 1;
c = Get(); c = Get();
if c == EOF { if c == EOF {
@ -252,7 +252,7 @@ func atoi() int // BUG: uses tokenbuf; should take argument
{ {
var v int = 0; var v int = 0;
for i := 0; i < tokenlen && '0' <= tokenbuf[i] && tokenbuf[i] <= '9'; i = i + 1 { for i := 0; i < tokenlen && '0' <= tokenbuf[i] && tokenbuf[i] <= '9'; i = i + 1 {
v = 10 * v + convert(int, tokenbuf[i] - '0'); v = 10 * v + int(tokenbuf[i] - '0');
} }
return v; return v;
} }

View File

@ -96,7 +96,7 @@ main()
z2[0] = 'a'; z2[0] = 'a';
z2[1] = 'b'; z2[1] = 'b';
z2[2] = 'c'; z2[2] = 'c';
c = string(z2); c = string(*z2);
if c != "abc" { if c != "abc" {
panic("create array pointer ", c); panic("create array pointer ", c);
} }

View File

@ -43,7 +43,7 @@ func test1() {
} }
for i := 0; i < v.Len(); i++ { for i := 0; i < v.Len(); i++ {
x := convert(*S, v.At(i)); x := v.At(i).(*S);
if x.val != v.Len() - i - 1 { if x.val != v.Len() - i - 1 {
panic("expected ", i, ", found ", x.val, "\n"); panic("expected ", i, ", found ", x.val, "\n");
} }