Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CaosDB Octave library
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 Octave library
Commits
12f26a90
Commit
12f26a90
authored
3 years ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Fixed Octave unit tests.
parent
4b7f7da5
No related branches found
No related tags found
1 merge request
!3
Full functionality of libcaosdb
Pipeline
#12953
passed with warnings
3 years ago
Stage: setup
Stage: test
Stage: deploy
Pipeline: caosdb-octaveinttest
#12954
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lib/maoxdb.cpp
+9
-9
9 additions, 9 deletions
src/lib/maoxdb.cpp
test/test_unittest.m
+2
-2
2 additions, 2 deletions
test/test_unittest.m
with
11 additions
and
11 deletions
src/lib/maoxdb.cpp
+
9
−
9
View file @
12f26a90
...
...
@@ -363,7 +363,7 @@ void assignEntityDataFromMx(ce::Entity &entity, const mxArray *array, const mwSi
entity
.
SetDataType
(
dataTypeFromMx
(
mxGetField
(
array
,
index
,
"datatype"
)));
entity
.
SetUnit
(
mxGetStdString
(
mxGetField
(
array
,
index
,
"unit"
)));
entity
.
SetValue
(
valueFromMx
(
mxGetField
(
array
,
index
,
"value"
)));
if
(
entity
.
GetRole
()
==
ce
::
Role
::
FILE
)
{
// This is necessary until caosdb-server#174 is fixed.
if
(
entity
.
GetRole
()
==
ce
::
Role
::
FILE
)
{
// This is necessary until caosdb-server#174 is fixed.
entity
.
SetFilePath
(
mxGetStdString
(
mxGetField
(
array
,
index
,
"filepath"
)));
entity
.
SetLocalPath
(
mxGetStdString
(
mxGetField
(
array
,
index
,
"localpath"
)));
}
...
...
@@ -514,28 +514,28 @@ auto valueFromMx(const mxArray *array) -> caosdb::entity::Value {
}
array
=
mxGetCell
(
array
,
0
);
numel
=
mxGetNumberOfElements
(
array
);
if
(
mxIsCell
(
array
))
{
// string cell array
if
(
mxIsCell
(
array
))
{
// string cell array
auto
content
=
std
::
vector
<
string
>
(
numel
);
for
(
size_t
i
=
0
;
i
<
numel
;
++
i
)
{
auto
value
=
mxGetStdString
(
mxGetCell
(
array
,
i
));
content
[
i
]
=
value
;
}
result
=
Value
(
content
);
}
else
if
(
mxIsLogical
(
array
))
{
// bool
}
else
if
(
mxIsLogical
(
array
))
{
// bool
auto
content
=
std
::
vector
<
bool
>
(
numel
);
auto
data
=
static_cast
<
bool
*>
(
mxGetData
(
array
));
for
(
size_t
i
=
0
;
i
<
numel
;
++
i
)
{
content
[
i
]
=
data
[
i
];
}
result
=
Value
(
content
);
}
else
if
(
mxIsInt64
(
array
))
{
// int
}
else
if
(
mxIsInt64
(
array
))
{
// int
auto
content
=
std
::
vector
<
INT64_T
>
(
numel
);
auto
data
=
static_cast
<
INT64_T
*>
(
mxGetData
(
array
));
for
(
size_t
i
=
0
;
i
<
numel
;
++
i
)
{
content
[
i
]
=
data
[
i
];
}
result
=
Value
(
content
);
}
else
if
(
mxIsDouble
(
array
))
{
// double
}
else
if
(
mxIsDouble
(
array
))
{
// double
auto
content
=
std
::
vector
<
double
>
(
numel
);
auto
data
=
static_cast
<
double
*>
(
mxGetData
(
array
));
for
(
size_t
i
=
0
;
i
<
numel
;
++
i
)
{
...
...
@@ -547,15 +547,15 @@ auto valueFromMx(const mxArray *array) -> caosdb::entity::Value {
boost
::
lexical_cast
<
std
::
string
>
((
mxGetClassID
(
array
)))
+
")"
);
}
}
else
{
// scalar value (no cell array)
if
(
mxIsChar
(
array
))
{
// string
if
(
mxIsChar
(
array
))
{
// string
result
=
Value
(
mxGetStdString
(
array
));
}
else
if
(
mxIsLogical
(
array
))
{
// bool
}
else
if
(
mxIsLogical
(
array
))
{
// bool
auto
data
=
*
static_cast
<
bool
*>
(
mxGetData
(
array
));
result
=
Value
(
data
);
}
else
if
(
mxIsInt64
(
array
))
{
// int
}
else
if
(
mxIsInt64
(
array
))
{
// int
auto
data
=
*
static_cast
<
INT64_T
*>
(
mxGetData
(
array
));
result
=
Value
(
data
);
}
else
if
(
mxIsDouble
(
array
))
{
// double
}
else
if
(
mxIsDouble
(
array
))
{
// double
auto
data
=
*
static_cast
<
double
*>
(
mxGetData
(
array
));
result
=
Value
(
data
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
test/test_unittest.m
+
2
−
2
View file @
12f26a90
...
...
@@ -46,7 +46,7 @@ function test_entity_conversion()
p1
.
name
=
"Prop 1"
;
p1
.
description
=
""
;
p1
.
importance
=
"somewhat"
;
p1
.
datatype
=
"DOUBLE"
;
p1
.
set_
datatype
(
"DOUBLE"
)
;
p1
.
unit
=
"Mt"
;
p1
.
value
=
[];
...
...
@@ -55,7 +55,7 @@ function test_entity_conversion()
p2
.
name
=
"Prop 2"
;
p2
.
description
=
""
;
p2
.
importance
=
"very"
;
p2
.
datatype
=
"BOOLEAN"
;
p2
.
set_
datatype
(
"BOOLEAN"
)
;
p2
.
value
=
1
;
par
=
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