Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-cppinttest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
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
Code review analytics
Issue 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
caosdb
Software
caosdb-cppinttest
Commits
e3ac0e51
Commit
e3ac0e51
authored
3 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Use datatype and value structs in test_ccaosdb
parent
2b4084e5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!16
Tests for value and datatype structs
Pipeline
#13781
passed
3 years ago
Stage: info
Stage: setup
Stage: build
Stage: test
Changes
1
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_ccaosdb.cpp
+28
-21
28 additions, 21 deletions
test/test_ccaosdb.cpp
with
28 additions
and
21 deletions
test/test_ccaosdb.cpp
+
28
−
21
View file @
e3ac0e51
...
@@ -298,7 +298,9 @@ TEST_F(test_ccaosdb, test_insert_update_delete) {
...
@@ -298,7 +298,9 @@ TEST_F(test_ccaosdb, test_insert_update_delete) {
caosdb_entity_create_entity
(
&
original_entity
);
caosdb_entity_create_entity
(
&
original_entity
);
caosdb_entity_entity_set_name
(
&
original_entity
,
"TestName"
);
caosdb_entity_entity_set_name
(
&
original_entity
,
"TestName"
);
caosdb_entity_entity_set_role
(
&
original_entity
,
"PROPERTY"
);
caosdb_entity_entity_set_role
(
&
original_entity
,
"PROPERTY"
);
caosdb_entity_entity_set_datatype
(
&
original_entity
,
"TEXT"
,
false
,
false
);
caosdb_entity_datatype
in_type
;
caosdb_entity_create_atomic_datatype
(
&
in_type
,
"TEXT"
);
caosdb_entity_entity_set_datatype
(
&
original_entity
,
&
in_type
);
caosdb_transaction_transaction
insert_transaction
;
caosdb_transaction_transaction
insert_transaction
;
caosdb_connection_connection_create_transaction
(
&
connection
,
caosdb_connection_connection_create_transaction
(
&
connection
,
...
@@ -347,17 +349,14 @@ TEST_F(test_ccaosdb, test_insert_update_delete) {
...
@@ -347,17 +349,14 @@ TEST_F(test_ccaosdb, test_insert_update_delete) {
caosdb_entity_entity_get_role
(
&
retrieved_entity_1
,
&
out
);
caosdb_entity_entity_get_role
(
&
retrieved_entity_1
,
&
out
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
bool
is_list_in
[]
=
{
false
};
// NOLINT
caosdb_entity_datatype
out_type
;
bool
is_ref_in
[]
=
{
false
};
// NOLINT
caosdb_entity_entity_get_datatype
(
&
original_entity
,
&
out_type
);
caosdb_entity_entity_get_datatype
(
&
original_entity
,
&
in
,
is_ref_in
,
bool
out_is
(
false
);
is_list_in
);
caosdb_entity_datatype_is_atomic
(
&
out_type
,
&
out_is
);
bool
is_list_out
[]
=
{
false
};
// NOLINT
EXPECT_TRUE
(
out_is
);
bool
is_ref_out
[]
=
{
false
};
// NOLINT
caosdb_entity_datatype_get_datatype_name
(
&
in_type
,
&
in
);
caosdb_entity_entity_get_datatype
(
&
retrieved_entity_1
,
&
out
,
is_ref_out
,
caosdb_entity_datatype_get_datatype_name
(
&
out_type
,
&
out
);
is_list_out
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
EXPECT_EQ
(
*
is_list_in
,
*
is_list_out
);
EXPECT_EQ
(
*
is_ref_in
,
*
is_ref_out
);
// Change name and update
// Change name and update
return_code
=
return_code
=
...
@@ -414,13 +413,12 @@ TEST_F(test_ccaosdb, test_insert_update_delete) {
...
@@ -414,13 +413,12 @@ TEST_F(test_ccaosdb, test_insert_update_delete) {
caosdb_entity_entity_get_role
(
&
retrieved_entity_2
,
&
out
);
caosdb_entity_entity_get_role
(
&
retrieved_entity_2
,
&
out
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
caosdb_entity_entity_get_datatype
(
&
original_entity
,
&
in
,
is_ref_in
,
caosdb_entity_entity_get_datatype
(
&
retrieved_entity_2
,
&
out_type
);
is_list_in
);
caosdb_entity_datatype_is_atomic
(
&
out_type
,
&
out_is
);
caosdb_entity_entity_get_datatype
(
&
retrieved_entity_2
,
&
out
,
is_ref_out
,
EXPECT_TRUE
(
out_is
);
is_list_out
);
caosdb_entity_datatype_get_datatype_name
(
&
in_type
,
&
in
);
caosdb_entity_datatype_get_datatype_name
(
&
out_type
,
&
out
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
EXPECT_EQ
(
*
is_ref_in
,
*
is_ref_out
);
EXPECT_EQ
(
*
is_list_in
,
*
is_list_out
);
// Now delete
// Now delete
caosdb_transaction_transaction
delete_transaction
;
caosdb_transaction_transaction
delete_transaction
;
...
@@ -472,6 +470,7 @@ TEST_F(test_ccaosdb, test_insert_update_delete) {
...
@@ -472,6 +470,7 @@ TEST_F(test_ccaosdb, test_insert_update_delete) {
caosdb_transaction_delete_transaction
(
&
retrieve_transaction_1
);
caosdb_transaction_delete_transaction
(
&
retrieve_transaction_1
);
caosdb_transaction_delete_transaction
(
&
insert_transaction
);
caosdb_transaction_delete_transaction
(
&
insert_transaction
);
caosdb_entity_delete_entity
(
&
original_entity
);
caosdb_entity_delete_entity
(
&
original_entity
);
caosdb_entity_delete_datatype
(
&
in_type
);
}
}
TEST_F
(
test_ccaosdb
,
test_insert_with_prop_and_parent
)
{
TEST_F
(
test_ccaosdb
,
test_insert_with_prop_and_parent
)
{
...
@@ -486,7 +485,9 @@ TEST_F(test_ccaosdb, test_insert_with_prop_and_parent) {
...
@@ -486,7 +485,9 @@ TEST_F(test_ccaosdb, test_insert_with_prop_and_parent) {
caosdb_entity_entity_set_name
(
&
original_prop
,
"TestProp"
);
caosdb_entity_entity_set_name
(
&
original_prop
,
"TestProp"
);
caosdb_entity_entity_set_role
(
&
original_prop
,
"PROPERTY"
);
caosdb_entity_entity_set_role
(
&
original_prop
,
"PROPERTY"
);
caosdb_entity_entity_set_datatype
(
&
original_prop
,
"TEXT"
,
false
,
false
);
caosdb_entity_datatype
original_type
;
caosdb_entity_create_atomic_datatype
(
&
original_type
,
"TEXT"
);
caosdb_entity_entity_set_datatype
(
&
original_prop
,
&
original_type
);
std
::
cout
<<
"Inserting a property..."
<<
std
::
endl
;
std
::
cout
<<
"Inserting a property..."
<<
std
::
endl
;
caosdb_transaction_transaction
prop_insertion
;
caosdb_transaction_transaction
prop_insertion
;
...
@@ -540,7 +541,9 @@ TEST_F(test_ccaosdb, test_insert_with_prop_and_parent) {
...
@@ -540,7 +541,9 @@ TEST_F(test_ccaosdb, test_insert_with_prop_and_parent) {
caosdb_entity_property
rec_prop
;
caosdb_entity_property
rec_prop
;
caosdb_entity_create_property
(
&
rec_prop
);
caosdb_entity_create_property
(
&
rec_prop
);
caosdb_entity_property_set_id
(
&
rec_prop
,
prop_id
);
caosdb_entity_property_set_id
(
&
rec_prop
,
prop_id
);
caosdb_entity_property_set_string_value
(
&
rec_prop
,
"Bla"
);
caosdb_entity_value
in_value
;
caosdb_entity_create_string_value
(
&
in_value
,
"Bla"
);
caosdb_entity_property_set_value
(
&
rec_prop
,
&
in_value
);
caosdb_entity_entity_append_property
(
&
original_rec
,
&
rec_prop
);
caosdb_entity_entity_append_property
(
&
original_rec
,
&
rec_prop
);
caosdb_transaction_transaction
rec_insertion
;
caosdb_transaction_transaction
rec_insertion
;
...
@@ -593,8 +596,10 @@ TEST_F(test_ccaosdb, test_insert_with_prop_and_parent) {
...
@@ -593,8 +596,10 @@ TEST_F(test_ccaosdb, test_insert_with_prop_and_parent) {
caosdb_entity_entity_get_name
(
&
original_prop
,
&
in
);
caosdb_entity_entity_get_name
(
&
original_prop
,
&
in
);
caosdb_entity_property_get_name
(
&
retrieved_property
,
&
out
);
caosdb_entity_property_get_name
(
&
retrieved_property
,
&
out
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
caosdb_entity_property_get_string_value
(
&
rec_prop
,
&
in
);
caosdb_entity_value
out_value
;
caosdb_entity_property_get_string_value
(
&
retrieved_property
,
&
out
);
caosdb_entity_property_get_value
(
&
retrieved_property
,
&
out_value
);
caosdb_entity_value_get_as_string
(
&
in_value
,
&
in
);
caosdb_entity_value_get_as_string
(
&
out_value
,
&
out
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
caosdb_transaction_delete_transaction
(
&
retrieve_transaction
);
caosdb_transaction_delete_transaction
(
&
retrieve_transaction
);
...
@@ -607,6 +612,8 @@ TEST_F(test_ccaosdb, test_insert_with_prop_and_parent) {
...
@@ -607,6 +612,8 @@ TEST_F(test_ccaosdb, test_insert_with_prop_and_parent) {
caosdb_entity_delete_entity
(
&
original_rt
);
caosdb_entity_delete_entity
(
&
original_rt
);
caosdb_transaction_delete_transaction
(
&
prop_insertion
);
caosdb_transaction_delete_transaction
(
&
prop_insertion
);
caosdb_entity_delete_entity
(
&
original_prop
);
caosdb_entity_delete_entity
(
&
original_prop
);
caosdb_entity_delete_datatype
(
&
original_type
);
caosdb_entity_delete_value
(
&
in_value
);
}
}
TEST_F
(
test_ccaosdb
,
test_up_n_download_file
)
{
TEST_F
(
test_ccaosdb
,
test_up_n_download_file
)
{
...
...
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