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
7c33f266
Commit
7c33f266
authored
Nov 22, 2010
by
Pieter Noordhuis
Browse files
Make test for formatting commands using a vector more robust
parent
cb89a472
Changes
1
Show whitespace changes
Inline
Side-by-side
test.c
View file @
7c33f266
...
@@ -73,9 +73,9 @@ static void test_format_commands() {
...
@@ -73,9 +73,9 @@ static void test_format_commands() {
const
char
*
argv
[
3
];
const
char
*
argv
[
3
];
argv
[
0
]
=
"SET"
;
argv
[
0
]
=
"SET"
;
argv
[
1
]
=
"foo"
;
argv
[
1
]
=
"foo
\0
xxx
"
;
argv
[
2
]
=
"bar"
;
argv
[
2
]
=
"bar"
;
size_t
lens
[
3
]
=
{
3
,
3
,
3
};
size_t
lens
[
3
]
=
{
3
,
7
,
3
};
int
argc
=
3
;
int
argc
=
3
;
test
(
"Format command by passing argc/argv without lengths: "
);
test
(
"Format command by passing argc/argv without lengths: "
);
...
@@ -86,8 +86,8 @@ static void test_format_commands() {
...
@@ -86,8 +86,8 @@ static void test_format_commands() {
test
(
"Format command by passing argc/argv with lengths: "
);
test
(
"Format command by passing argc/argv with lengths: "
);
len
=
redisFormatCommandArgv
(
&
cmd
,
argc
,
argv
,
lens
);
len
=
redisFormatCommandArgv
(
&
cmd
,
argc
,
argv
,
lens
);
test_cond
(
strncmp
(
cmd
,
"*3
\r\n
$3
\r\n
SET
\r\n
$
3
\r\n
foo
\r\n
$3
\r\n
bar
\r\n
"
,
len
)
==
0
&&
test_cond
(
strncmp
(
cmd
,
"*3
\r\n
$3
\r\n
SET
\r\n
$
7
\r\n
foo
\
0
xxx
\
r\n
$3
\r\n
bar
\r\n
"
,
len
)
==
0
&&
len
==
4
+
4
+
(
3
+
2
)
+
4
+
(
3
+
2
)
+
4
+
(
3
+
2
));
len
==
4
+
4
+
(
3
+
2
)
+
4
+
(
7
+
2
)
+
4
+
(
3
+
2
));
free
(
cmd
);
free
(
cmd
);
}
}
...
...
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