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
2d63f016
Verified
Commit
2d63f016
authored
3 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
BUG: fixed typo in ccaosdb and added tests
parent
49573d03
No related branches found
No related tags found
1 merge request
!23
Copy constructor for result set and entity
Pipeline
#13192
passed
3 years ago
Stage: info
Stage: setup
Stage: test
Stage: deploy
Pipeline: caosdb-cppinttest
#13194
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ccaosdb.cpp
+3
-3
3 additions, 3 deletions
src/ccaosdb.cpp
test/test_ccaosdb.cpp
+82
-5
82 additions, 5 deletions
test/test_ccaosdb.cpp
with
85 additions
and
8 deletions
src/ccaosdb.cpp
+
3
−
3
View file @
2d63f016
...
...
@@ -726,8 +726,8 @@ ERROR_RETURN_CODE(GENERIC_ERROR,
return
0
;
})
ERROR_RETURN_CODE
(
GENERIC_ERROR
,
int
caosdb_entity_entity_get_boolean_
value_
list_value_at
(
caosdb_entity_entity
*
entity
,
bool
*
out
,
const
int
index
),
int
caosdb_entity_entity_get_boolean_list_value_at
(
caosdb_entity_entity
*
entity
,
bool
*
out
,
const
int
index
),
{
auto
*
wrapped_entity
=
WRAPPED_ENTITY_CAST
(
entity
);
auto
value_list
=
wrapped_entity
->
GetValue
().
AsList
();
...
...
@@ -981,7 +981,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR,
return
0
;
})
ERROR_RETURN_CODE
(
GENERIC_ERROR
,
int
caosdb_entity_property_get_boolean_
value_
list_value_at
(
int
caosdb_entity_property_get_boolean_list_value_at
(
caosdb_entity_property
*
property
,
bool
*
out
,
const
int
index
),
{
auto
*
wrapped_property
=
WRAPPED_PROPERTY_CAST
(
property
);
...
...
This diff is collapsed.
Click to expand it.
test/test_ccaosdb.cpp
+
82
−
5
View file @
2d63f016
...
...
@@ -24,6 +24,7 @@
#include
"caosdb/status_code.h"
// for StatusCode
#include
"caosdb_test_utility.h"
// for EXPECT_THROW_MESSAGE, TEST_DATA_DIR
#include
"ccaosdb.h"
// for caosdb_utility_get_env_fallback
#include
<cstdint>
// for int64_t
#include
<cstring>
// for strcmp
#include
<gtest/gtest-message.h>
// for Message
#include
<gtest/gtest-test-part.h>
// for SuiteApiResolver, TestFactoryImpl
...
...
@@ -263,7 +264,7 @@ TEST_F(test_ccaosdb, test_property) {
EXPECT_EQ
(
return_code
,
0
);
}
TEST_F
(
test_ccaosdb
,
test_list_property
)
{
TEST_F
(
test_ccaosdb
,
test_
string_
list_property
)
{
caosdb_entity_property
property
;
int
return_code
(
caosdb_entity_create_property
(
&
property
));
...
...
@@ -285,12 +286,12 @@ TEST_F(test_ccaosdb, test_list_property) {
EXPECT_FALSE
(
*
is_ref
);
EXPECT_TRUE
(
*
is_list
);
int
length
[]
=
{
0
}
;
// NOLINT
return_code
=
caosdb_entity_property_get_value_list_length
(
&
property
,
length
);
int
length
=
-
1
;
// NOLINT
return_code
=
caosdb_entity_property_get_value_list_length
(
&
property
,
&
length
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
*
length
,
3
);
EXPECT_EQ
(
length
,
3
);
for
(
int
i
=
0
;
i
<
*
length
;
i
++
)
{
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
return_code
=
caosdb_entity_property_get_string_list_value_at
(
&
property
,
&
out
,
i
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
strcmp
(
value_list
[
i
],
out
),
0
);
// NOLINT
...
...
@@ -300,6 +301,82 @@ TEST_F(test_ccaosdb, test_list_property) {
EXPECT_EQ
(
return_code
,
0
);
}
TEST_F
(
test_ccaosdb
,
test_int_list_property
)
{
caosdb_entity_property
property
;
int
return_code
(
caosdb_entity_create_property
(
&
property
));
EXPECT_EQ
(
return_code
,
0
);
return_code
=
caosdb_entity_property_set_datatype
(
&
property
,
"INTEGER"
,
false
,
true
);
EXPECT_EQ
(
return_code
,
0
);
const
int64_t
value_list
[]
=
{
1
,
2
,
3
};
// NOLINT
return_code
=
caosdb_entity_property_set_int_list_value
(
&
property
,
&
(
value_list
)[
0
],
3
);
EXPECT_EQ
(
return_code
,
0
);
char
*
dt_out
=
nullptr
;
// NOLINT
bool
is_ref
[]
=
{
false
};
// NOLINT
bool
is_list
[]
=
{
false
};
// NOLINT
return_code
=
caosdb_entity_property_get_datatype
(
&
property
,
&
dt_out
,
is_ref
,
is_list
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_STREQ
(
dt_out
,
"INTEGER"
);
EXPECT_FALSE
(
*
is_ref
);
EXPECT_TRUE
(
*
is_list
);
int
length
=
-
1
;
// NOLINT
return_code
=
caosdb_entity_property_get_value_list_length
(
&
property
,
&
length
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
length
,
3
);
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
int64_t
out
=
-
1
;
return_code
=
caosdb_entity_property_get_int_list_value_at
(
&
property
,
&
out
,
i
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
value_list
[
i
],
out
);
// NOLINT
}
return_code
=
caosdb_entity_delete_property
(
&
property
);
EXPECT_EQ
(
return_code
,
0
);
}
TEST_F
(
test_ccaosdb
,
test_bool_list_property
)
{
caosdb_entity_property
property
;
int
return_code
(
caosdb_entity_create_property
(
&
property
));
EXPECT_EQ
(
return_code
,
0
);
return_code
=
caosdb_entity_property_set_datatype
(
&
property
,
"BOOLEAN"
,
false
,
true
);
EXPECT_EQ
(
return_code
,
0
);
const
bool
value_list
[]
=
{
true
,
true
,
false
};
// NOLINT
return_code
=
caosdb_entity_property_set_boolean_list_value
(
&
property
,
&
(
value_list
)[
0
],
3
);
EXPECT_EQ
(
return_code
,
0
);
char
*
dt_out
=
nullptr
;
// NOLINT
bool
is_ref
[]
=
{
false
};
// NOLINT
bool
is_list
[]
=
{
false
};
// NOLINT
return_code
=
caosdb_entity_property_get_datatype
(
&
property
,
&
dt_out
,
is_ref
,
is_list
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_STREQ
(
dt_out
,
"BOOLEAN"
);
EXPECT_FALSE
(
*
is_ref
);
EXPECT_TRUE
(
*
is_list
);
int
length
=
-
1
;
// NOLINT
return_code
=
caosdb_entity_property_get_value_list_length
(
&
property
,
&
length
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
length
,
3
);
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
bool
out
=
true
;
return_code
=
caosdb_entity_property_get_boolean_list_value_at
(
&
property
,
&
out
,
i
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
value_list
[
i
],
out
);
// NOLINT
}
return_code
=
caosdb_entity_delete_property
(
&
property
);
EXPECT_EQ
(
return_code
,
0
);
}
TEST_F
(
test_ccaosdb
,
test_entity_with_parent_and_property
)
{
caosdb_entity_parent
input_parent
;
int
return_code
(
caosdb_entity_create_parent
(
&
input_parent
));
...
...
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