Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
f8762577
Commit
f8762577
authored
Sep 19, 2010
by
Pieter Noordhuis
Browse files
Change function prototype
parent
c18b5889
Changes
1
Hide whitespace changes
Inline
Side-by-side
test.c
View file @
f8762577
...
...
@@ -9,13 +9,13 @@
/* The following line is our testing "framework" :) */
#define test_cond(_c) if(_c) printf("PASSED\n"); else {printf("FAILED\n"); fails++;}
long
long
usec
(
void
)
{
static
long
long
usec
(
void
)
{
struct
timeval
tv
;
gettimeofday
(
&
tv
,
NULL
);
return
(((
long
long
)
tv
.
tv_sec
)
*
1000000
)
+
tv
.
tv_usec
;
}
void
connect
(
int
*
fd
)
{
static
void
__
connect
(
int
*
fd
)
{
redisReply
*
reply
=
redisConnect
(
fd
,
"127.0.0.1"
,
6379
);
if
(
reply
!=
NULL
)
{
printf
(
"Connection error: %s"
,
reply
->
reply
);
...
...
@@ -28,7 +28,7 @@ int main(void) {
int
i
,
fails
=
0
;
long
long
t1
,
t2
;
redisReply
*
reply
;
connect
(
&
fd
);
__
connect
(
&
fd
);
/* test 0 */
printf
(
"#0 Returns I/O error when the connection is lost: "
);
...
...
@@ -36,7 +36,7 @@ int main(void) {
test_cond
(
reply
->
type
==
REDIS_REPLY_ERROR
&&
strcasecmp
(
reply
->
reply
,
"i/o error"
)
==
0
);
freeReplyObject
(
reply
);
connect
(
&
fd
);
/* reconnect */
__
connect
(
&
fd
);
/* reconnect */
/* test 1 */
printf
(
"#1 Is able to deliver commands: "
);
...
...
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