Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
210360228
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2021
210360228
Commits
fcfac6df
Commit
fcfac6df
authored
5 years ago
by
yaphet
Committed by
dangleptr
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Fix] Insert multi version tag and edge's order error (#854)
* test edge miss * fix mutli version
parent
16a59bd9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/executor/test/DataTest.cpp
+62
-0
62 additions, 0 deletions
src/executor/test/DataTest.cpp
with
62 additions
and
0 deletions
src/executor/test/DataTest.cpp
+
62
−
0
View file @
fcfac6df
...
...
@@ -359,6 +359,68 @@ TEST_F(DataTest, InsertVertex) {
// TODO: Test insert multi tags, and delete one of them then check other existent
}
TEST_F
(
DataTest
,
InsertMultiVersionTest
)
{
// Insert multi version vertex
{
cpp2
::
ExecutionResponse
resp
;
std
::
string
cmd
=
"INSERT VERTEX person(name, age) VALUES "
"hash(
\"
Tony
\"
):(
\"
Tony
\"
, 18), "
"hash(
\"
Mack
\"
):(
\"
Mack
\"
, 19)"
;
auto
code
=
client_
->
execute
(
cmd
,
resp
);
ASSERT_EQ
(
cpp2
::
ErrorCode
::
SUCCEEDED
,
code
);
}
{
cpp2
::
ExecutionResponse
resp
;
std
::
string
cmd
=
"INSERT VERTEX person(name, age) VALUES "
"hash(
\"
Mack
\"
):(
\"
Mack
\"
, 20)"
;
auto
code
=
client_
->
execute
(
cmd
,
resp
);
ASSERT_EQ
(
cpp2
::
ErrorCode
::
SUCCEEDED
,
code
);
}
{
cpp2
::
ExecutionResponse
resp
;
std
::
string
cmd
=
"INSERT VERTEX person(name, age) VALUES "
"hash(
\"
Mack
\"
):(
\"
Mack
\"
, 21)"
;
auto
code
=
client_
->
execute
(
cmd
,
resp
);
ASSERT_EQ
(
cpp2
::
ErrorCode
::
SUCCEEDED
,
code
);
}
// Insert multi version edge
{
cpp2
::
ExecutionResponse
resp
;
std
::
string
cmd
=
"INSERT EDGE schoolmate(likeness) VALUES "
"hash(
\"
Tony
\"
)->hash(
\"
Mack
\"
)@1:(1)"
;
auto
code
=
client_
->
execute
(
cmd
,
resp
);
ASSERT_EQ
(
cpp2
::
ErrorCode
::
SUCCEEDED
,
code
);
}
{
cpp2
::
ExecutionResponse
resp
;
std
::
string
cmd
=
"INSERT EDGE schoolmate(likeness) VALUES "
"hash(
\"
Tony
\"
)->hash(
\"
Mack
\"
)@1:(2)"
;
auto
code
=
client_
->
execute
(
cmd
,
resp
);
ASSERT_EQ
(
cpp2
::
ErrorCode
::
SUCCEEDED
,
code
);
}
{
cpp2
::
ExecutionResponse
resp
;
std
::
string
cmd
=
"INSERT EDGE schoolmate(likeness) VALUES "
"hash(
\"
Tony
\"
)->hash(
\"
Mack
\"
)@1:(3)"
;
auto
code
=
client_
->
execute
(
cmd
,
resp
);
ASSERT_EQ
(
cpp2
::
ErrorCode
::
SUCCEEDED
,
code
);
}
// Get result
{
cpp2
::
ExecutionResponse
resp
;
std
::
string
cmd
=
"GO FROM hash(
\"
Tony
\"
) OVER schoolmate "
"YIELD $$.person.name, $$.person.age, schoolmate.likeness"
;
auto
code
=
client_
->
execute
(
cmd
,
resp
);
ASSERT_EQ
(
cpp2
::
ErrorCode
::
SUCCEEDED
,
code
);
using
valueType
=
std
::
tuple
<
std
::
string
,
int64_t
,
int64_t
>
;
// Get the latest result
std
::
vector
<
valueType
>
expected
{
{
"Mack"
,
21
,
3
},
};
ASSERT_TRUE
(
verifyResult
(
resp
,
expected
));
}
}
TEST_F
(
DataTest
,
FindTest
)
{
{
cpp2
::
ExecutionResponse
resp
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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