Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-cpplib
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-cpplib
Commits
567276d2
Commit
567276d2
authored
3 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
DRAFT: Continue setters and getters
parent
1da6c37a
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!13
ENH: Add datatypes and value classes to Extern C interface
Pipeline
#12256
failed
3 years ago
Stage: info
Stage: setup
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/ccaosdb.h
+29
-25
29 additions, 25 deletions
include/ccaosdb.h
src/ccaosdb.cpp
+253
-136
253 additions, 136 deletions
src/ccaosdb.cpp
test/test_ccaosdb.cpp
+52
-44
52 additions, 44 deletions
test/test_ccaosdb.cpp
with
334 additions
and
205 deletions
include/ccaosdb.h
+
29
−
25
View file @
567276d2
...
@@ -334,13 +334,13 @@ typedef struct {
...
@@ -334,13 +334,13 @@ typedef struct {
}
caosdb_entity_message
;
}
caosdb_entity_message
;
// GETTERS FOR EVERYTHING
// GETTERS FOR EVERYTHING
int
caosdb_entity_entity_get_id
(
caosdb_entity_entity
*
entity
,
char
*
out
);
int
caosdb_entity_entity_get_id
(
caosdb_entity_entity
*
entity
,
char
*
*
out
);
int
caosdb_entity_entity_get_role
(
caosdb_entity_entity
*
entity
,
char
*
out
);
int
caosdb_entity_entity_get_role
(
caosdb_entity_entity
*
entity
,
char
*
*
out
);
int
caosdb_entity_entity_get_name
(
caosdb_entity_entity
*
entity
,
char
*
out
);
int
caosdb_entity_entity_get_name
(
caosdb_entity_entity
*
entity
,
char
*
*
out
);
int
caosdb_entity_entity_get_description
(
caosdb_entity_entity
*
entity
,
int
caosdb_entity_entity_get_description
(
caosdb_entity_entity
*
entity
,
char
*
out
);
char
*
*
out
);
int
caosdb_entity_entity_get_datatype
(
caosdb_entity_entity
*
entity
,
char
*
out
);
int
caosdb_entity_entity_get_datatype
(
caosdb_entity_entity
*
entity
,
char
*
*
out
);
int
caosdb_entity_entity_get_unit
(
caosdb_entity_entity
*
entity
,
char
*
out
);
int
caosdb_entity_entity_get_unit
(
caosdb_entity_entity
*
entity
,
char
*
*
out
);
int
caosdb_entity_entity_get_int_value
(
caosdb_entity_entity
*
entity
,
long
*
out
);
int
caosdb_entity_entity_get_int_value
(
caosdb_entity_entity
*
entity
,
long
*
out
);
int
caosdb_entity_entity_get_double_value
(
caosdb_entity_entity
*
entity
,
int
caosdb_entity_entity_get_double_value
(
caosdb_entity_entity
*
entity
,
...
@@ -348,18 +348,20 @@ int caosdb_entity_entity_get_double_value(caosdb_entity_entity *entity,
...
@@ -348,18 +348,20 @@ int caosdb_entity_entity_get_double_value(caosdb_entity_entity *entity,
int
caosdb_entity_entity_get_boolean_value
(
caosdb_entity_entity
*
entity
,
int
caosdb_entity_entity_get_boolean_value
(
caosdb_entity_entity
*
entity
,
bool
*
out
);
bool
*
out
);
int
caosdb_entity_entity_get_string_value
(
caosdb_entity_entity
*
entity
,
int
caosdb_entity_entity_get_string_value
(
caosdb_entity_entity
*
entity
,
char
*
out
);
char
*
*
out
);
int
caosdb_entity_entity_get_int_list_value
(
caosdb_entity_entity
*
entity
,
int
caosdb_entity_entity_get_int_list_value
(
caosdb_entity_entity
*
entity
,
long
*
*
out
);
long
*
out
);
int
caosdb_entity_entity_get_double_list_value
(
caosdb_entity_entity
*
entity
,
int
caosdb_entity_entity_get_double_list_value
(
caosdb_entity_entity
*
entity
,
double
*
*
out
);
double
*
out
);
int
caosdb_entity_entity_get_boolean_list_value
(
caosdb_entity_entity
*
entity
,
int
caosdb_entity_entity_get_boolean_list_value
(
caosdb_entity_entity
*
entity
,
bool
*
*
out
);
bool
*
out
);
int
caosdb_entity_entity_get_string_list_value
(
caosdb_entity_entity
*
entity
,
int
caosdb_entity_entity_get_string_list_value
(
caosdb_entity_entity
*
entity
,
char
**
out
);
char
**
out
);
int
caosdb_entity_entity_get_value_list_length
(
caosdb_entity_entity
*
entity
,
int
*
out
);
int
caosdb_entity_entity_get_version_id
(
caosdb_entity_entity
*
entity
,
int
caosdb_entity_entity_get_version_id
(
caosdb_entity_entity
*
entity
,
char
*
out
);
char
*
*
out
);
int
caosdb_entity_entity_get_errors_size
(
caosdb_entity_entity
*
entity
,
int
caosdb_entity_entity_get_errors_size
(
caosdb_entity_entity
*
entity
,
int
*
out
);
int
*
out
);
int
caosdb_entity_entity_get_error
(
caosdb_entity_entity
*
entity
,
int
caosdb_entity_entity_get_error
(
caosdb_entity_entity
*
entity
,
...
@@ -380,17 +382,17 @@ int caosdb_entity_entity_get_parents_size(caosdb_entity_entity *entity,
...
@@ -380,17 +382,17 @@ int caosdb_entity_entity_get_parents_size(caosdb_entity_entity *entity,
int
caosdb_entity_entity_get_parent
(
caosdb_entity_entity
*
entity
,
int
caosdb_entity_entity_get_parent
(
caosdb_entity_entity
*
entity
,
caosdb_entity_parent
*
out
,
int
index
);
caosdb_entity_parent
*
out
,
int
index
);
int
caosdb_entity_property_get_id
(
caosdb_entity_property
*
property
,
char
*
out
);
int
caosdb_entity_property_get_id
(
caosdb_entity_property
*
property
,
char
*
*
out
);
int
caosdb_entity_property_get_name
(
caosdb_entity_property
*
property
,
int
caosdb_entity_property_get_name
(
caosdb_entity_property
*
property
,
char
*
out
);
char
*
*
out
);
int
caosdb_entity_property_get_description
(
caosdb_entity_property
*
property
,
int
caosdb_entity_property_get_description
(
caosdb_entity_property
*
property
,
char
*
out
);
char
*
*
out
);
int
caosdb_entity_property_get_importance
(
caosdb_entity_property
*
property
,
int
caosdb_entity_property_get_importance
(
caosdb_entity_property
*
property
,
char
*
out
);
char
*
*
out
);
int
caosdb_entity_property_get_datatype
(
caosdb_entity_property
*
property
,
int
caosdb_entity_property_get_datatype
(
caosdb_entity_property
*
property
,
char
*
out
);
char
*
*
out
);
int
caosdb_entity_property_get_unit
(
caosdb_entity_property
*
property
,
int
caosdb_entity_property_get_unit
(
caosdb_entity_property
*
property
,
char
*
out
);
char
*
*
out
);
int
caosdb_entity_property_get_int_value
(
caosdb_entity_property
*
property
,
int
caosdb_entity_property_get_int_value
(
caosdb_entity_property
*
property
,
long
*
out
);
long
*
out
);
...
@@ -399,24 +401,26 @@ int caosdb_entity_property_get_double_value(caosdb_entity_property *property,
...
@@ -399,24 +401,26 @@ int caosdb_entity_property_get_double_value(caosdb_entity_property *property,
int
caosdb_entity_property_get_boolean_value
(
caosdb_entity_property
*
property
,
int
caosdb_entity_property_get_boolean_value
(
caosdb_entity_property
*
property
,
bool
*
out
);
bool
*
out
);
int
caosdb_entity_property_get_string_value
(
caosdb_entity_property
*
property
,
int
caosdb_entity_property_get_string_value
(
caosdb_entity_property
*
property
,
char
*
out
);
char
*
*
out
);
int
caosdb_entity_property_get_int_list_value
(
caosdb_entity_property
*
property
,
int
caosdb_entity_property_get_int_list_value
(
caosdb_entity_property
*
property
,
long
**
out
);
long
**
out
);
int
caosdb_entity_property_get_double_list_value
(
int
caosdb_entity_property_get_double_list_value
(
caosdb_entity_property
*
property
,
double
*
*
out
);
caosdb_entity_property
*
property
,
double
*
out
);
int
caosdb_entity_property_get_boolean_list_value
(
int
caosdb_entity_property_get_boolean_list_value
(
caosdb_entity_property
*
property
,
bool
*
*
out
);
caosdb_entity_property
*
property
,
bool
*
out
);
int
caosdb_entity_property_get_string_list_value
(
int
caosdb_entity_property_get_string_list_value
(
caosdb_entity_property
*
property
,
char
**
out
);
caosdb_entity_property
*
property
,
char
*
out
[]);
int
caosdb_entity_property_get_value_list_length
(
caosdb_entity_property
*
property
,
int
*
out
);
int
caosdb_entity_parent_get_id
(
caosdb_entity_parent
*
parent
,
char
*
out
);
int
caosdb_entity_parent_get_id
(
caosdb_entity_parent
*
parent
,
char
*
*
out
);
int
caosdb_entity_parent_get_name
(
caosdb_entity_parent
*
parent
,
char
*
out
);
int
caosdb_entity_parent_get_name
(
caosdb_entity_parent
*
parent
,
char
*
*
out
);
int
caosdb_entity_parent_get_description
(
caosdb_entity_parent
*
parent
,
int
caosdb_entity_parent_get_description
(
caosdb_entity_parent
*
parent
,
char
*
out
);
char
*
*
out
);
int
caosdb_entity_message_get_code
(
caosdb_entity_message
*
message
,
int
*
out
);
int
caosdb_entity_message_get_code
(
caosdb_entity_message
*
message
,
int
*
out
);
int
caosdb_entity_message_get_description
(
caosdb_entity_message
*
message
,
int
caosdb_entity_message_get_description
(
caosdb_entity_message
*
message
,
char
*
out
);
char
*
*
out
);
// CONSTRUCTORS AND DESTRUCTORS
// CONSTRUCTORS AND DESTRUCTORS
int
caosdb_entity_create_entity
(
caosdb_entity_entity
*
out
);
int
caosdb_entity_create_entity
(
caosdb_entity_entity
*
out
);
...
...
This diff is collapsed.
Click to expand it.
src/ccaosdb.cpp
+
253
−
136
View file @
567276d2
This diff is collapsed.
Click to expand it.
test/test_ccaosdb.cpp
+
52
−
44
View file @
567276d2
...
@@ -165,8 +165,8 @@ TEST_F(test_ccaosdb, test_entity) {
...
@@ -165,8 +165,8 @@ TEST_F(test_ccaosdb, test_entity) {
// the strings for the rest
// the strings for the rest
return_code
=
caosdb_entity_entity_set_name
(
&
entity
,
"length"
);
return_code
=
caosdb_entity_entity_set_name
(
&
entity
,
"length"
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
char
out
[
255
]
=
{
"a"
}
;
// NOLINT
char
*
out
=
nullptr
;
// NOLINT
return_code
=
caosdb_entity_entity_get_name
(
&
entity
,
out
);
return_code
=
caosdb_entity_entity_get_name
(
&
entity
,
&
out
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
strcmp
(
out
,
"length"
),
0
);
EXPECT_EQ
(
strcmp
(
out
,
"length"
),
0
);
...
@@ -176,7 +176,7 @@ TEST_F(test_ccaosdb, test_entity) {
...
@@ -176,7 +176,7 @@ TEST_F(test_ccaosdb, test_entity) {
// EXPECT_EQ(strcmp(out, "Property"), 0);
// EXPECT_EQ(strcmp(out, "Property"), 0);
caosdb_entity_entity_set_description
(
&
entity
,
"The length of an object"
);
caosdb_entity_entity_set_description
(
&
entity
,
"The length of an object"
);
caosdb_entity_entity_get_description
(
&
entity
,
out
);
caosdb_entity_entity_get_description
(
&
entity
,
&
out
);
EXPECT_EQ
(
strcmp
(
out
,
"The length of an object"
),
0
);
EXPECT_EQ
(
strcmp
(
out
,
"The length of an object"
),
0
);
// TODO(fspreck)
// TODO(fspreck)
...
@@ -185,13 +185,18 @@ TEST_F(test_ccaosdb, test_entity) {
...
@@ -185,13 +185,18 @@ TEST_F(test_ccaosdb, test_entity) {
// EXPECT_EQ(strcmp(out, "DOUBLE"), 0);
// EXPECT_EQ(strcmp(out, "DOUBLE"), 0);
caosdb_entity_entity_set_unit
(
&
entity
,
"m"
);
caosdb_entity_entity_set_unit
(
&
entity
,
"m"
);
caosdb_entity_entity_get_unit
(
&
entity
,
out
);
caosdb_entity_entity_get_unit
(
&
entity
,
&
out
);
EXPECT_EQ
(
strcmp
(
out
,
"m"
),
0
);
EXPECT_EQ
(
strcmp
(
out
,
"m"
),
0
);
// TODO(fspreck)
return_code
=
caosdb_entity_entity_set_double_value
(
&
entity
,
5.0
);
caosdb_entity_entity_set_double_value
(
&
entity
,
5.0
);
EXPECT_EQ
(
return_code
,
0
);
// caosdb_entity_entity_get_value(&entity, out);
double
value
[]
=
{
0.0
};
// NOLINT
// EXPECT_EQ(strcmp(out, "5.0"), 0);
std
::
cout
<<
*
value
<<
std
::
endl
;
return_code
=
caosdb_entity_entity_get_double_value
(
&
entity
,
value
);
std
::
cout
<<
*
value
<<
std
::
endl
;
EXPECT_EQ
(
return_code
,
0
);
// TODO(fspreck) Re-enable once role and datatype are set
// EXPECT_EQ(*value, 5.0);
return_code
=
caosdb_entity_delete_entity
(
&
entity
);
return_code
=
caosdb_entity_delete_entity
(
&
entity
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
...
@@ -206,11 +211,11 @@ TEST_F(test_ccaosdb, test_parent) {
...
@@ -206,11 +211,11 @@ TEST_F(test_ccaosdb, test_parent) {
caosdb_entity_parent_set_id
(
&
parent
,
"some_id"
);
caosdb_entity_parent_set_id
(
&
parent
,
"some_id"
);
caosdb_entity_parent_set_name
(
&
parent
,
"some_name"
);
caosdb_entity_parent_set_name
(
&
parent
,
"some_name"
);
char
out
[
255
]
=
{
"a"
}
;
// NOLINT
char
*
out
=
nullptr
;
// NOLINT
caosdb_entity_parent_get_id
(
&
parent
,
out
);
caosdb_entity_parent_get_id
(
&
parent
,
&
out
);
EXPECT_EQ
(
strcmp
(
out
,
"some_id"
),
0
);
EXPECT_EQ
(
strcmp
(
out
,
"some_id"
),
0
);
caosdb_entity_parent_get_name
(
&
parent
,
out
);
caosdb_entity_parent_get_name
(
&
parent
,
&
out
);
EXPECT_EQ
(
strcmp
(
out
,
"some_name"
),
0
);
EXPECT_EQ
(
strcmp
(
out
,
"some_name"
),
0
);
return_code
=
caosdb_entity_delete_parent
(
&
parent
);
return_code
=
caosdb_entity_delete_parent
(
&
parent
);
...
@@ -232,11 +237,11 @@ TEST_F(test_ccaosdb, test_property) {
...
@@ -232,11 +237,11 @@ TEST_F(test_ccaosdb, test_property) {
caosdb_entity_property_set_unit
(
&
property
,
"some_unit"
);
caosdb_entity_property_set_unit
(
&
property
,
"some_unit"
);
caosdb_entity_property_set_string_value
(
&
property
,
"some_value"
);
caosdb_entity_property_set_string_value
(
&
property
,
"some_value"
);
char
out
[
255
]
=
{
"a"
}
;
// NOLINT
char
*
out
=
nullptr
;
// NOLINT
caosdb_entity_property_get_id
(
&
property
,
out
);
caosdb_entity_property_get_id
(
&
property
,
&
out
);
EXPECT_EQ
(
strcmp
(
out
,
"some_id"
),
0
);
EXPECT_EQ
(
strcmp
(
out
,
"some_id"
),
0
);
caosdb_entity_property_get_name
(
&
property
,
out
);
caosdb_entity_property_get_name
(
&
property
,
&
out
);
EXPECT_EQ
(
strcmp
(
out
,
"some_name"
),
0
);
EXPECT_EQ
(
strcmp
(
out
,
"some_name"
),
0
);
// TODO(fspreck)
// TODO(fspreck)
...
@@ -247,7 +252,7 @@ TEST_F(test_ccaosdb, test_property) {
...
@@ -247,7 +252,7 @@ TEST_F(test_ccaosdb, test_property) {
// caosdb_entity_property_get_importance(&property, out);
// caosdb_entity_property_get_importance(&property, out);
// EXPECT_EQ(strcmp(out, "FIX"), 0);
// EXPECT_EQ(strcmp(out, "FIX"), 0);
caosdb_entity_property_get_unit
(
&
property
,
out
);
caosdb_entity_property_get_unit
(
&
property
,
&
out
);
EXPECT_EQ
(
strcmp
(
out
,
"some_unit"
),
0
);
EXPECT_EQ
(
strcmp
(
out
,
"some_unit"
),
0
);
// TODO(fspreck)
// TODO(fspreck)
...
@@ -270,8 +275,9 @@ TEST_F(test_ccaosdb, test_list_property) {
...
@@ -270,8 +275,9 @@ TEST_F(test_ccaosdb, test_list_property) {
// return_code = caosdb_entity_property_set_datatype(&property, "LIST<TEXT>");
// return_code = caosdb_entity_property_set_datatype(&property, "LIST<TEXT>");
// EXPECT_EQ(return_code, 0);
// EXPECT_EQ(return_code, 0);
const
*
char
[]
value_list
=
{
"val0"
,
"val1"
,
"val2"
};
// NOLINT
const
char
*
value_list
[]
=
{
"val0"
,
"val1"
,
"val2"
};
// NOLINT
return_code
=
caosdb_entity_property_set_string_list_value
(
&
property
,
value_list
,
3
);
return_code
=
caosdb_entity_property_set_string_list_value
(
&
property
,
value_list
,
3
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
// TODO(fspreck)
// TODO(fspreck)
...
@@ -280,7 +286,19 @@ TEST_F(test_ccaosdb, test_list_property) {
...
@@ -280,7 +286,19 @@ TEST_F(test_ccaosdb, test_list_property) {
// EXPECT_EQ(return_code, 0);
// EXPECT_EQ(return_code, 0);
// EXPECT_EQ(strcmp(out_type, "LIST<TEXT>"));
// EXPECT_EQ(strcmp(out_type, "LIST<TEXT>"));
int
length
[]
=
{
0
};
// NOLINT
return_code
=
caosdb_entity_property_get_value_list_length
(
&
property
,
length
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
*
length
,
3
);
// TODO(fspreck) get and compare values in list
// TODO(fspreck) get and compare values in list
char
*
out_list
[
*
length
];
// NOLINT
return_code
=
caosdb_entity_property_get_string_list_value
(
&
property
,
out_list
);
// NOLINT
EXPECT_EQ
(
return_code
,
0
);
for
(
int
i
=
0
;
i
<
*
length
;
i
++
)
{
EXPECT_EQ
(
strcmp
(
value_list
[
i
],
out_list
[
i
]),
0
);
// NOLINT
}
return_code
=
caosdb_entity_delete_property
(
&
property
);
return_code
=
caosdb_entity_delete_property
(
&
property
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
...
@@ -309,14 +327,12 @@ TEST_F(test_ccaosdb, test_entity_with_parent_and_property) {
...
@@ -309,14 +327,12 @@ TEST_F(test_ccaosdb, test_entity_with_parent_and_property) {
return_code
=
caosdb_entity_create_entity
(
&
entity
);
return_code
=
caosdb_entity_create_entity
(
&
entity
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
std
::
cout
<<
"Appending parent and property ..."
<<
std
::
endl
;
return_code
=
caosdb_entity_entity_append_parent
(
&
entity
,
&
input_parent
);
return_code
=
caosdb_entity_entity_append_parent
(
&
entity
,
&
input_parent
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
return_code
=
caosdb_entity_entity_append_property
(
&
entity
,
&
input_property
);
return_code
=
caosdb_entity_entity_append_property
(
&
entity
,
&
input_property
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
std
::
cout
<<
"Counting parents and properties ..."
<<
std
::
endl
;
int
count
[]
=
{
0
};
// NOLINT
int
count
[]
=
{
0
};
// NOLINT
return_code
=
caosdb_entity_entity_get_parents_size
(
&
entity
,
count
);
return_code
=
caosdb_entity_entity_get_parents_size
(
&
entity
,
count
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
...
@@ -326,26 +342,22 @@ TEST_F(test_ccaosdb, test_entity_with_parent_and_property) {
...
@@ -326,26 +342,22 @@ TEST_F(test_ccaosdb, test_entity_with_parent_and_property) {
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
*
count
,
1
);
EXPECT_EQ
(
*
count
,
1
);
char
in
[
255
]
=
{
"a"
}
;
// NOLINT
char
*
in
=
nullptr
;
// NOLINT
char
out
[
255
]
=
{
"b"
}
;
// NOLINT
char
*
out
=
nullptr
;
// NOLINT
std
::
cout
<<
"Comparing ..."
<<
std
::
endl
;
// cannot assign an already assigned property
// cannot assign an already assigned property
return_code
=
caosdb_entity_entity_get_property
(
&
entity
,
&
input_property
,
0
);
return_code
=
caosdb_entity_entity_get_property
(
&
entity
,
&
input_property
,
0
);
EXPECT_EQ
(
return_code
,
caosdb
::
StatusCode
::
EXTERN_C_ASSIGNMENT_ERROR
);
EXPECT_EQ
(
return_code
,
caosdb
::
StatusCode
::
EXTERN_C_ASSIGNMENT_ERROR
);
caosdb_entity_property
output_property
;
caosdb_entity_property
output_property
;
return_code
=
caosdb_entity_entity_get_property
(
&
entity
,
&
output_property
,
0
);
return_code
=
caosdb_entity_entity_get_property
(
&
entity
,
&
output_property
,
0
);
std
::
cout
<<
"Got output property."
<<
std
::
endl
;
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
caosdb_entity_property_get_id
(
&
input_property
,
in
);
caosdb_entity_property_get_id
(
&
input_property
,
&
in
);
std
::
cout
<<
"Got input id."
<<
std
::
endl
;
caosdb_entity_property_get_id
(
&
output_property
,
&
out
);
caosdb_entity_property_get_id
(
&
output_property
,
out
);
std
::
cout
<<
"Got output id."
<<
std
::
endl
;
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
caosdb_entity_property_get_name
(
&
input_property
,
in
);
caosdb_entity_property_get_name
(
&
input_property
,
&
in
);
caosdb_entity_property_get_name
(
&
output_property
,
out
);
caosdb_entity_property_get_name
(
&
output_property
,
&
out
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
// TODO(fspreck)
// TODO(fspreck)
...
@@ -353,27 +365,23 @@ TEST_F(test_ccaosdb, test_entity_with_parent_and_property) {
...
@@ -353,27 +365,23 @@ TEST_F(test_ccaosdb, test_entity_with_parent_and_property) {
// caosdb_entity_property_get_datatype(&output_property, out);
// caosdb_entity_property_get_datatype(&output_property, out);
// EXPECT_EQ(strcmp(in, out), 0);
// EXPECT_EQ(strcmp(in, out), 0);
// TODO(fspreck)
caosdb_entity_property_get_string_value
(
&
input_property
,
&
in
);
// caosdb_entity_property_get_value(&input_property, in);
caosdb_entity_property_get_string_value
(
&
output_property
,
&
out
);
// caosdb_entity_property_get_value(&output_property, out);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
// EXPECT_EQ(strcmp(in, out), 0);
std
::
cout
<<
"Comparing parent..."
<<
std
::
endl
;
caosdb_entity_parent
output_parent
;
caosdb_entity_parent
output_parent
;
return_code
=
caosdb_entity_entity_get_parent
(
&
entity
,
&
output_parent
,
0
);
return_code
=
caosdb_entity_entity_get_parent
(
&
entity
,
&
output_parent
,
0
);
std
::
cout
<<
"Got output parent."
<<
std
::
endl
;
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
caosdb_entity_parent_get_id
(
&
input_parent
,
in
);
caosdb_entity_parent_get_id
(
&
input_parent
,
&
in
);
caosdb_entity_parent_get_id
(
&
output_parent
,
out
);
caosdb_entity_parent_get_id
(
&
output_parent
,
&
out
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
caosdb_entity_parent_get_name
(
&
input_parent
,
in
);
caosdb_entity_parent_get_name
(
&
input_parent
,
&
in
);
caosdb_entity_parent_get_name
(
&
output_parent
,
out
);
caosdb_entity_parent_get_name
(
&
output_parent
,
&
out
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
// Delete everything
// Delete everything
std
::
cout
<<
"Deleting ..."
<<
std
::
endl
;
return_code
=
caosdb_entity_delete_parent
(
&
input_parent
);
return_code
=
caosdb_entity_delete_parent
(
&
input_parent
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
return_code
=
caosdb_entity_delete_property
(
&
input_property
);
return_code
=
caosdb_entity_delete_property
(
&
input_property
);
...
@@ -433,13 +441,13 @@ TEST_F(test_ccaosdb, test_remove_property) {
...
@@ -433,13 +441,13 @@ TEST_F(test_ccaosdb, test_remove_property) {
return_code
=
caosdb_entity_entity_get_property
(
&
entity
,
&
out_prop
,
0
);
return_code
=
caosdb_entity_entity_get_property
(
&
entity
,
&
out_prop
,
0
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
char
in
[
255
]
=
{
"a"
}
;
// NOLINT
char
*
in
=
nullptr
;
// NOLINT
char
out
[
255
]
=
{
"b"
}
;
// NOLINT
char
*
out
=
nullptr
;
// NOLINT
// Deleted the first property, so the second one should remain.
// Deleted the first property, so the second one should remain.
return_code
=
caosdb_entity_property_get_name
(
&
in_prop_2
,
in
);
return_code
=
caosdb_entity_property_get_name
(
&
in_prop_2
,
&
in
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
return_code
=
caosdb_entity_property_get_name
(
&
out_prop
,
out
);
return_code
=
caosdb_entity_property_get_name
(
&
out_prop
,
&
out
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
0
);
EXPECT_EQ
(
strcmp
(
in
,
out
),
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