Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
3fb5f329
Commit
3fb5f329
authored
Feb 19, 2012
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test/chan: document tests
R=golang-dev, bradfitz CC=golang-dev
https://golang.org/cl/5677094
parent
13514d4e
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
36 additions
and
13 deletions
+36
-13
doubleselect.go
test/chan/doubleselect.go
+2
-1
fifo.go
test/chan/fifo.go
+1
-1
goroutines.go
test/chan/goroutines.go
+2
-2
nonblock.go
test/chan/nonblock.go
+2
-2
perm.go
test/chan/perm.go
+4
-0
powser1.go
test/chan/powser1.go
+2
-0
powser2.go
test/chan/powser2.go
+6
-3
select.go
test/chan/select.go
+2
-0
select2.go
test/chan/select2.go
+2
-0
select3.go
test/chan/select3.go
+1
-1
select4.go
test/chan/select4.go
+2
-0
select5.go
test/chan/select5.go
+4
-1
select6.go
test/chan/select6.go
+1
-1
sieve1.go
test/chan/sieve1.go
+2
-0
sieve2.go
test/chan/sieve2.go
+2
-0
zerosize.go
test/chan/zerosize.go
+1
-1
No files found.
test/chan/doubleselect.go
View file @
3fb5f329
...
@@ -4,8 +4,9 @@
...
@@ -4,8 +4,9 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
// T
his test is designed to flush out the case where
two cases of a select can
// T
est the situation in which
two cases of a select can
// both end up running. See http://codereview.appspot.com/180068.
// both end up running. See http://codereview.appspot.com/180068.
package
main
package
main
import
(
import
(
...
...
test/chan/fifo.go
View file @
3fb5f329
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
//
Verify
that unbuffered channels act as pure fifos.
//
Test
that unbuffered channels act as pure fifos.
package
main
package
main
...
...
test/chan/goroutines.go
View file @
3fb5f329
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
//
make a lot of goroutines, threaded together
.
//
Torture test for goroutines
.
// tear them down cleanly.
//
Make a lot of goroutines, threaded together, and
tear them down cleanly.
package
main
package
main
...
...
test/chan/nonblock.go
View file @
3fb5f329
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
//
Verify channel operations that test for blocking
//
Test channel operations that test for blocking.
// Use several sizes and types of operands
// Use several sizes and types of operands
.
package
main
package
main
...
...
test/chan/perm.go
View file @
3fb5f329
...
@@ -4,6 +4,10 @@
...
@@ -4,6 +4,10 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
// Test various correct and incorrect permutations of send-only,
// receive-only, and bidirectional channels.
// Does not compile.
package
main
package
main
var
(
var
(
...
...
test/chan/powser1.go
View file @
3fb5f329
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
// Test concurrency primitives: power series.
// Power series package
// Power series package
// A power series is a channel, along which flow rational
// A power series is a channel, along which flow rational
// coefficients. A denominator of zero signifies the end.
// coefficients. A denominator of zero signifies the end.
...
...
test/chan/powser2.go
View file @
3fb5f329
...
@@ -4,15 +4,18 @@
...
@@ -4,15 +4,18 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
// Test concurrency primitives: power series.
// Like powser1.go but uses channels of interfaces.
// Has not been cleaned up as much as powser1.go, to keep
// it distinct and therefore a different test.
// Power series package
// Power series package
// A power series is a channel, along which flow rational
// A power series is a channel, along which flow rational
// coefficients. A denominator of zero signifies the end.
// coefficients. A denominator of zero signifies the end.
// Original code in Newsqueak by Doug McIlroy.
// Original code in Newsqueak by Doug McIlroy.
// See Squinting at Power Series by Doug McIlroy,
// See Squinting at Power Series by Doug McIlroy,
// http://www.cs.bell-labs.com/who/rsc/thread/squint.pdf
// http://www.cs.bell-labs.com/who/rsc/thread/squint.pdf
// Like powser1.go but uses channels of interfaces.
// Has not been cleaned up as much as powser1.go, to keep
// it distinct and therefore a different test.
package
main
package
main
...
...
test/chan/select.go
View file @
3fb5f329
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
// Test simple select.
package
main
package
main
var
counter
uint
var
counter
uint
...
...
test/chan/select2.go
View file @
3fb5f329
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
// Test that selects do not consume undue memory.
package
main
package
main
import
"runtime"
import
"runtime"
...
...
test/chan/select3.go
View file @
3fb5f329
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
// Test
s verifying
the semantics of the select statement
// Test the semantics of the select statement
// for basic empty/non-empty cases.
// for basic empty/non-empty cases.
package
main
package
main
...
...
test/chan/select4.go
View file @
3fb5f329
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file
// license that can be found in the LICENSE file
// Test that a select statement proceeds when a value is ready.
package
main
package
main
func
f
()
*
int
{
func
f
()
*
int
{
...
...
test/chan/select5.go
View file @
3fb5f329
...
@@ -7,7 +7,10 @@
...
@@ -7,7 +7,10 @@
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
// Generate test of channel operations and simple selects.
// Generate test of channel operations and simple selects.
// Only doing one real send or receive at a time, but phrased
// The output of this program is compiled and run to do the
// actual test.
// Each test does only one real send or receive at a time, but phrased
// in various ways that the compiler may or may not rewrite
// in various ways that the compiler may or may not rewrite
// into simpler expressions.
// into simpler expressions.
...
...
test/chan/select6.go
View file @
3fb5f329
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
// Issue 2075
//
Test for select:
Issue 2075
// A bug in select corrupts channel queues of failed cases
// A bug in select corrupts channel queues of failed cases
// if there are multiple waiters on those channels and the
// if there are multiple waiters on those channels and the
// select is the last in the queue. If further waits are made
// select is the last in the queue. If further waits are made
...
...
test/chan/sieve1.go
View file @
3fb5f329
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
// Test concurrency primitives: classical inefficient concurrent prime sieve.
// Generate primes up to 100 using channels, checking the results.
// Generate primes up to 100 using channels, checking the results.
// This sieve consists of a linear chain of divisibility filters,
// This sieve consists of a linear chain of divisibility filters,
// equivalent to trial-dividing each n by all primes p ≤ n.
// equivalent to trial-dividing each n by all primes p ≤ n.
...
...
test/chan/sieve2.go
View file @
3fb5f329
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
// Test concurrency primitives: prime sieve of Eratosthenes.
// Generate primes up to 100 using channels, checking the results.
// Generate primes up to 100 using channels, checking the results.
// This sieve is Eratosthenesque and only considers odd candidates.
// This sieve is Eratosthenesque and only considers odd candidates.
// See discussion at <http://blog.onideas.ws/eratosthenes.go>.
// See discussion at <http://blog.onideas.ws/eratosthenes.go>.
...
...
test/chan/zerosize.go
View file @
3fb5f329
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
//
Making channels of a zero-sized type should not panic
.
//
Test making channels of a zero-sized type
.
package
main
package
main
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment