URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [ken/] [cplx5.go] - Rev 700
Compare with Previous | Blame | View Log
// $G $D/$F.go && $L $F.$A && ./$A.out// Copyright 2010 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package mainvar a [12]complex128var s []complex128var c chan complex128var f struct {c complex128}var m map[complex128]complex128func main() {// array of complex128for i := 0; i < len(a); i++ {a[i] = complex(float64(i), float64(-i))}if a[5] != 5-5i {panic(a[5])}// slice of complex128s = make([]complex128, len(a))for i := 0; i < len(s); i++ {s[i] = a[i]}if s[5] != 5-5i {panic(s[5])}// chanc = make(chan complex128)go chantest(c)vc := <-cif vc != 5-5i {panic(vc)}// pointer of complex128v := a[5]pv := &vif *pv != 5-5i {panic(*pv)}// field of complex128f.c = a[5]if f.c != 5-5i {panic(f.c)}// map of complex128m = make(map[complex128]complex128)for i := 0; i < len(s); i++ {m[-a[i]] = a[i]}if m[5i-5] != 5-5i {panic(m[5i-5])}vm := m[complex(-5, 5)]if vm != 5-5i {panic(vm)}}func chantest(c chan complex128) { c <- a[5] }
