Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
7f9ef7a8
Commit
7f9ef7a8
authored
13 years ago
by
Konstantin Shulgin
Browse files
Options
Downloads
Patches
Plain Diff
bug-extra-test-for-update-cmd:
Extra UPDATE command tests was added.
parent
2a754e20
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/connector_c/update.c
+55
-1
55 additions, 1 deletion
test/connector_c/update.c
test/connector_c/update.result
+31
-0
31 additions, 0 deletions
test/connector_c/update.result
with
86 additions
and
1 deletion
test/connector_c/update.c
+
55
−
1
View file @
7f9ef7a8
...
@@ -90,7 +90,8 @@ update_set_str(struct tnt_stream *stream, i32 field, char *str);
...
@@ -90,7 +90,8 @@ update_set_str(struct tnt_stream *stream, i32 field, char *str);
/** add update fields operation: splice string */
/** add update fields operation: splice string */
void
void
update_splice_str
(
struct
tnt_stream
*
stream
,
i32
field
,
i32
offset
,
i32
length
,
char
*
list
);
update_splice_str
(
struct
tnt_stream
*
stream
,
i32
field
,
i32
offset
,
i32
length
,
char
*
list
);
/** add update fields operation: delete field */
/** add update fields operation: delete field */
void
void
...
@@ -166,6 +167,10 @@ test_set_and_splice();
...
@@ -166,6 +167,10 @@ test_set_and_splice();
void
void
test_delete_field
();
test_delete_field
();
/** update fields test case: boundary arguments values test */
void
test_boundary_args
();
/*==========================================================================
/*==========================================================================
* function definition
* function definition
...
@@ -185,6 +190,7 @@ main(void)
...
@@ -185,6 +190,7 @@ main(void)
test_splice
();
test_splice
();
test_set_and_splice
();
test_set_and_splice
();
test_delete_field
();
test_delete_field
();
test_boundary_args
();
/* clean-up suite */
/* clean-up suite */
test_suite_tear_down
();
test_suite_tear_down
();
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
...
@@ -413,6 +419,13 @@ test_simple_set()
...
@@ -413,6 +419,13 @@ test_simple_set()
update
(
1
,
stream
);
update
(
1
,
stream
);
tnt_stream_free
(
stream
);
tnt_stream_free
(
stream
);
/* test set primary key */
stream
=
tnt_buf
(
NULL
);
printf
(
"# test set primary key
\n
"
);
update_set_i32
(
stream
,
0
,
2
);
update
(
1
,
stream
);
tnt_stream_free
(
stream
);
printf
(
"<<< test simple set done
\n
"
);
printf
(
"<<< test simple set done
\n
"
);
}
}
...
@@ -684,6 +697,14 @@ test_set_and_splice()
...
@@ -684,6 +697,14 @@ test_set_and_splice()
update
(
1
,
stream
);
update
(
1
,
stream
);
tnt_stream_free
(
stream
);
tnt_stream_free
(
stream
);
/* test splice to long and set to short */
stream
=
tnt_buf
(
NULL
);
printf
(
"# test splice to long and set to short
\n
"
);
update_splice_str
(
stream
,
3
,
-
5
,
5
,
long_string
);
update_set_str
(
stream
,
2
,
"short name"
);
update
(
1
,
stream
);
tnt_stream_free
(
stream
);
printf
(
"<<< test set and splice done
\n
"
);
printf
(
"<<< test set and splice done
\n
"
);
}
}
...
@@ -792,3 +813,36 @@ test_delete_field()
...
@@ -792,3 +813,36 @@ test_delete_field()
printf
(
"<<< test delete field done
\n
"
);
printf
(
"<<< test delete field done
\n
"
);
}
}
void
test_boundary_args
()
{
const
int
max_update_op_cnt
=
128
;
printf
(
">>> test boundaty argumets values
\n
"
);
/* insert tuple */
printf
(
"# insert tuple
\n
"
);
struct
tnt_tuple
*
tuple
=
tnt_tuple
(
NULL
,
"%d%d"
,
0
,
1
);
insert_tuple
(
tuple
);
tnt_tuple_free
(
tuple
);
/* test simple delete fields */
struct
tnt_stream
*
stream
=
tnt_buf
(
NULL
);
printf
(
"# test: try to do update w/o operations
\n
"
);
update
(
0
,
stream
);
tnt_stream_free
(
stream
);
stream
=
tnt_buf
(
NULL
);
printf
(
"# test: update w/ maximal allowed opearions count
\n
"
);
for
(
int
i
=
0
;
i
<
max_update_op_cnt
;
++
i
)
tnt_update_arith
(
stream
,
1
,
TNT_UPDATE_ADD
,
1
);
update
(
0
,
stream
);
tnt_stream_free
(
stream
);
stream
=
tnt_buf
(
NULL
);
printf
(
"# test: update w/ grater than maximal allowed opearions count
\n
"
);
for
(
int
i
=
0
;
i
<
max_update_op_cnt
+
1
;
++
i
)
tnt_update_arith
(
stream
,
1
,
TNT_UPDATE_ADD
,
1
);
update
(
0
,
stream
);
tnt_stream_free
(
stream
);
}
This diff is collapsed.
Click to expand it.
test/connector_c/update.result
+
31
−
0
View file @
7f9ef7a8
...
@@ -8,6 +8,9 @@ update fields: respond ok (op: 19, reqid: 0, code: 0, count: 1)
...
@@ -8,6 +8,9 @@ update fields: respond ok (op: 19, reqid: 0, code: 0, count: 1)
# set field
# set field
update fields: respond ok (op: 19, reqid: 0, code: 0, count: 1)
update fields: respond ok (op: 19, reqid: 0, code: 0, count: 1)
(1 (0x00000001), 'field's new value', '', 1130450022 (0x43614c66))
(1 (0x00000001), 'field's new value', '', 1130450022 (0x43614c66))
# test set primary key
update fields: respond ok (op: 19, reqid: 0, code: 0, count: 1)
(2 (0x00000002), 'field's new value', '', 1130450022 (0x43614c66))
<<< test simple set done
<<< test simple set done
>>> test long set
>>> test long set
# insert tuple
# insert tuple
...
@@ -165,6 +168,23 @@ Princess Leia races home aboard her
...
@@ -165,6 +168,23 @@ Princess Leia races home aboard her
starship, custodian of the stolen plans
starship, custodian of the stolen plans
that can save her people and restore
that can save her people and restore
freedom to the galaxy....', 'third')
freedom to the galaxy....', 'third')
# test splice to long and set to short
update fields: respond ok (op: 19, reqid: 0, code: 0, count: 1)
(1 (0x00000001), 'first', 'short name', 'A long time ago, in a galaxy far, far away...
It is a period of civil war. Rebel
spaceships, striking from a hidden
base, have won their first victory
against the evil Galactic Empire.
During the battle, Rebel spies managed
to steal secret plans to the Empire's
ultimate weapon, the Death Star, an
armored space station with enough
power to destroy an entire planet.
Pursued by the Empire's sinister agents,
Princess Leia races home aboard her
starship, custodian of the stolen plans
that can save her people and restore
freedom to the galaxy....')
<<< test set and splice done
<<< test set and splice done
>>> test delete field
>>> test delete field
# insert tuple
# insert tuple
...
@@ -195,3 +215,14 @@ update fields: respond ok (op: 19, reqid: 0, code: 13826, count: 0)
...
@@ -195,3 +215,14 @@ update fields: respond ok (op: 19, reqid: 0, code: 13826, count: 0)
select: respond ok (op: 17, reqid: 0, code: 0, count: 1)
select: respond ok (op: 17, reqid: 0, code: 0, count: 1)
(1 (0x00000001), 9 (0x00000009), 10 (0x0000000a), 'fourth', 'fifth', 'eighth', 'ninth')
(1 (0x00000001), 9 (0x00000009), 10 (0x0000000a), 'fourth', 'fifth', 'eighth', 'ninth')
<<< test delete field done
<<< test delete field done
>>> test boundaty argumets values
# insert tuple
insert: respond ok (op: 13, reqid: 0, code: 0, count: 1)
(0 (0x00000000), 1 (0x00000001))
# test: try to do update w/o operations
update fields: respond ok (op: 19, reqid: 0, code: 514, count: 0)
# test: update w/ maximal allowed opearions count
update fields: respond ok (op: 19, reqid: 0, code: 0, count: 1)
(0 (0x00000000), 129 (0x00000081))
# test: update w/ grater than maximal allowed opearions count
update fields: respond ok (op: 19, reqid: 0, code: 514, count: 0)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment