OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/gnu-dev/or1k-gcc/gcc/testsuite
    from Rev 697 to Rev 698
    Reverse comparison

Rev 697 → Rev 698

/go.go-torture/execute/map-1.go
0,0 → 1,46
package main
 
func main() {
v := make(map[int] int);
v[0] = 0;
v[1000000] = 1;
if v[0] != 0 {
panic(1)
}
val, present := v[0];
if !present || val != 0 {
panic(2)
}
val = 5;
val, present = v[1];
if present || val != 0 {
panic(3);
}
if v[2] != 0 {
panic(4)
}
val, present = v[2];
if present {
panic(5)
}
if len(v) != 2 {
panic(6)
}
v[0] = 0, false;
if len(v) != 1 {
panic(7)
}
 
w := make(map[string] string);
if len(w) != 0 {
panic(8)
}
w["Hello"] = "world";
w["Goodbye"] = "sweet prince";
if w["Hello"] != "world" {
panic(9)
}
if w["Hej"] != "" {
panic(10)
}
}
/go.go-torture/execute/expr-1.go
0,0 → 1,11
package main
 
func main() {
var v1 = 1;
var v2 = 1;
var v3 = (v1 + v2) / (v1 + v2);
var v4 = (v3 * v3) % (v3 * v3);
if v4 != 0 {
panic(0)
}
}
/go.go-torture/execute/array-1.go
0,0 → 1,10
package main
var a [2]int;
func fn() {
a[0] = 1;
a[1] = 1;
}
func main() {
fn();
if a[0] != a[1] { panic(0) }
}
/go.go-torture/execute/array-2.go
0,0 → 1,19
package main
 
func fn(a []int) int {
alen := len(a);
for i := 0; i < alen; i++ {
a[i] = i
}
return alen;
}
 
func main() {
var a [2]int;
if fn(a[0:]) != 2 {
panic(0);
}
if a[0] != 0 || a[1] != 1 {
panic(1);
}
}
/go.go-torture/execute/return-1.go
0,0 → 1,4
package main
 
func main() {
}
/go.go-torture/execute/select-1.go
0,0 → 1,28
package main
 
func main() {
ch1 := make(chan int);
ch2 := make(chan int);
go func (ch1, ch2 chan int) { ch1 <- 1; ch2 <- 2; } (ch1, ch2);
count := 0;
var v int;
for count != 2 {
select
{
case v := <- ch1:
if v != 1 {
panic(0)
}
count++
 
case v = <- ch2:
if v != 2 {
panic(1)
}
count++
}
}
if v != 2 {
panic(2)
}
}
/go.go-torture/execute/method-1.go
0,0 → 1,7
package main
type s struct { i int };
func (v *s) val() int { return v.i }
func main() {
p := new(s);
if p.val() != 0 { panic(0) }
}
/go.go-torture/execute/pointer-1.go
0,0 → 1,7
package main
 
func main() {
p := new(int);
*p = 0;
if *p != 0 { panic(0) }
}
/go.go-torture/execute/return-2.go
0,0 → 1,18
package main
 
func fn() (i, j int) {
i = 1;
j = 2;
return;
}
 
func main() {
var i, j = fn();
var ret int;
if i == 1 && j == 2 {
ret = 0;
} else {
ret = 1;
}
if ret != 0 { panic(0) }
}
/go.go-torture/execute/return-3.go
0,0 → 1,16
package main
 
func fn() (i, j int) {
return 1, 2
}
 
func main() {
var i, j = fn();
var ret int;
if i == 1 && j == 2 {
ret = 0;
} else {
ret = 1;
}
if ret != 0 { panic(0) }
}
/go.go-torture/execute/nested-1.go
0,0 → 1,4
package main
func main() {
if func (i int) int { return i} (0) != 0 { panic(0) }
}
/go.go-torture/execute/struct-1.go
0,0 → 1,8
package main
 
func main() {
type s struct { x int; };
var ret s;
ret.x = 1;
if ret.x != 1 { panic(0) }
}
/go.go-torture/execute/function-1.go
0,0 → 1,9
package main
 
func subr() int {
return 0
}
 
func main() {
if subr() != 0 { panic(0) }
}
/go.go-torture/execute/struct-2.go
0,0 → 1,7
package main
 
func main() {
type s struct { x int; y int; };
var ret s = s{1, 2};
if ret.y - (ret.x + ret.x) != 0 { panic(0) }
}
/go.go-torture/execute/function-2.go
0,0 → 1,9
package main
 
func subr(p int) int {
return p
}
 
func main() {
if subr(0) != 0 { panic(0) }
}
/go.go-torture/execute/for-1.go
0,0 → 1,9
package main
 
func main() {
sum := 0;
for i := 0; i < 10; i++ {
sum += i;
}
if sum != 45 { panic(0) }
}
/go.go-torture/execute/const-1.go
0,0 → 1,6
package main
 
func main() {
const c = 2;
if c != 2 { panic(0) }
}
/go.go-torture/execute/for-2.go
0,0 → 1,52
package main
 
func f1() {
j := 0;
for i := 0; i < 10; i++ {
if i > 2 {
break;
}
j = i;
}
if (j != 2) {
panic(0);
}
}
 
func f2() {
for i := 0; i < 10; i++ {
if i >= 0 {
continue;
}
panic(1);
}
}
 
func f3() {
lab1:
for i := 0; i < 10; i++ {
for j := 0; j < 10; j++ {
if j > 2 {
break lab1;
}
}
panic(2);
}
}
 
func f4() {
lab1:
for i := 0; i < 10; i++ {
for j := 0; j < 10; j++ {
continue lab1;
}
panic(3);
}
}
 
func main() {
f1();
f2();
f3();
f4()
}
/go.go-torture/execute/const-2.go
0,0 → 1,7
package main
 
const c = 3;
 
func main() {
if c != 3 { panic(0) }
}
/go.go-torture/execute/var-1.go
0,0 → 1,6
package main
 
func main() {
var ret = 0;
if ret != 0 { panic(0) }
}
/go.go-torture/execute/var-2.go
0,0 → 1,6
package main
 
func main() {
var ret int;
if ret != 0 { panic(0) }
}
/go.go-torture/execute/var-3.go
0,0 → 1,6
package main
 
func main() {
ret := 0;
if ret != 0 { panic(0) }
}
/go.go-torture/execute/execute.exp
0,0 → 1,33
# Copyright (C) 2009 Free Software Foundation, Inc.
 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
 
# This is based on a file written by Rob Savoye (rob@cygnus.com) and
# Jeffrey Wheat (cassidy@cygnus.com).
 
if $tracelevel then {
strace $tracelevel
}
 
# load support procs
load_lib go-torture.exp
 
foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.go]] {
# If we're only testing specific files and this isn't one of them, skip it.
if ![runtest_file_p $runtests $testcase] then {
continue
}
go-torture-execute $testcase
}
/go.go-torture/execute/switch-1.go
0,0 → 1,68
package main
 
func f1(i int) bool {
switch j := i; j {
case 3: fallthrough
case 1: return true
case 2: return false
default: return false
case 4: return true
}
}
 
func f2(i int) int {
switch {
case i < 0: return -1
case i > 0: return 1
default: return 0
case i != 0: return 1000
}
panic(0)
}
 
func f3(i int) int {
lab:
switch i {
case 1: break
case 2: return 2
case 3, 4:
switch i {
case 3: break lab
case 4: break
}
return 4
}
return 1
}
 
func main() {
if !f1(1) {
panic(1);
}
if f1(2) {
panic(2);
}
if !f1(3) {
panic(3);
}
if !f1(4) {
panic(4);
}
if f1(5) {
panic(5);
}
 
if f2(-100) != -1 {
panic(6);
}
if f2(1000) != 1 {
panic(7);
}
if f2(0) != 0 {
panic(8);
}
 
if f3(1) != 1 || f3(2) != 2 || f3(3) != 1 || f3(4) != 4 {
panic(9);
}
}
/go.go-torture/execute/go-1.go
0,0 → 1,11
package main
 
func send_one(c chan <- int) {
c <- 0;
}
 
func main() {
c := make(chan int);
go send_one(c);
if <-c != 0 { panic(0) }
}
/go.go-torture/execute/go-2.go
0,0 → 1,11
package main
 
func send_one(c chan <- int, val int) {
c <- val;
}
 
func main() {
c := make(chan int);
go send_one(c, 0);
if <-c != 0 { panic(0) }
}
/go.go-torture/execute/string-1.go
0,0 → 1,15
package main
 
func fn(s string) int {
if s[0] != 'a' || s[1] != 'b' || s[2] != 'c' {
panic(0);
}
return len(s);
}
 
func main() {
s := "abc";
if fn(s) != 3 {
panic(1);
}
}
/go.go-torture/execute/go-3.go
0,0 → 1,14
package main
 
type I interface { send(chan <- int) }
 
type S struct { v int }
func (p *S) send(c chan <- int) { c <- p.v }
 
func main() {
s := S{0};
var i I = &s;
c := make(chan int);
go i.send(c);
if <- c != 0 { panic(0) }
}
/go.go-torture/execute/string-2.go
0,0 → 1,16
package main
 
func fn(s string) string {
if len(s) != 3 {
panic(0)
}
i := len(s) - 1;
return s + s[0 : i];
}
 
func main() {
s := fn("abc");
if s != "abcab" {
panic(1)
}
}
/go.go-torture/execute/goto-1.go
0,0 → 1,7
package main
 
func main() {
goto lab;
panic(0);
lab:
}
/go.go-torture/execute/chan-1.go
0,0 → 1,7
package main
 
func main() {
c := make(chan int, 1);
c <- 0;
if <-c != 0 { panic(0) }
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.