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
fbe7ba5b
Commit
fbe7ba5b
authored
Jul 16, 2008
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
strengthen test by checking values
SVN=127601
parent
f6c13bb2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
nonblock.go
test/chan/nonblock.go
+15
-10
No files found.
test/chan/nonblock.go
View file @
fbe7ba5b
...
...
@@ -14,23 +14,23 @@ func pause() {
}
func
i32receiver
(
c
*
chan
int32
)
{
<-
c
if
<-
c
!=
123
{
panic
"i32 value"
}
}
func
i32sender
(
c
*
chan
int32
)
{
c
-<
1
c
-<
234
}
func
i64receiver
(
c
*
chan
int64
)
{
<-
c
if
<-
c
!=
123456
{
panic
"i64 value"
}
}
func
i64sender
(
c
*
chan
int64
)
{
c
-<
1
c
-<
234567
}
func
breceiver
(
c
*
chan
bool
)
{
<-
c
if
!
<-
c
{
panic
"b value"
}
}
func
bsender
(
c
*
chan
bool
)
{
...
...
@@ -38,11 +38,11 @@ func bsender(c *chan bool) {
}
func
sreceiver
(
c
*
chan
string
)
{
<-
c
if
<-
c
!=
"hello"
{
panic
"s value"
}
}
func
ssender
(
c
*
chan
string
)
{
c
-<
"h
i
"
c
-<
"h
ello again
"
}
func
main
()
{
...
...
@@ -71,21 +71,23 @@ func main() {
go
i32receiver
(
c32
);
pause
();
ok
=
c32
-<
1
;
ok
=
c32
-<
1
23
;
if
!
ok
{
panic
"i32receiver"
}
go
i32sender
(
c32
);
pause
();
i32
,
ok
=
<-
c32
;
if
!
ok
{
panic
"i32sender"
}
if
i32
!=
234
{
panic
"i32sender value"
}
go
i64receiver
(
c64
);
pause
();
ok
=
c64
-<
1
;
ok
=
c64
-<
1
23456
;
if
!
ok
{
panic
"i64receiver"
}
go
i64sender
(
c64
);
pause
();
i64
,
ok
=
<-
c64
;
if
!
ok
{
panic
"i64sender"
}
if
i64
!=
234567
{
panic
"i64sender value"
}
go
breceiver
(
cb
);
pause
();
...
...
@@ -95,13 +97,16 @@ func main() {
pause
();
b
,
ok
=
<-
cb
;
if
!
ok
{
panic
"bsender"
}
if
!
b
{
panic
"bsender value"
}
go
sreceiver
(
cs
);
pause
();
ok
=
cs
-<
"h
i
"
;
ok
=
cs
-<
"h
ello
"
;
if
!
ok
{
panic
"sreceiver"
}
go
ssender
(
cs
);
pause
();
s
,
ok
=
<-
cs
;
if
!
ok
{
panic
"ssender"
}
if
s
!=
"hello again"
{
panic
"ssender value"
}
print
"PASS
\n
"
}
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