Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
Libhdbpp Timescale
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
LOFAR2.0
Libhdbpp Timescale
Commits
b8a4401a
Commit
b8a4401a
authored
6 years ago
by
Stuart Mark James
Browse files
Options
Downloads
Patches
Plain Diff
Fix and test traits valid check
parent
ca016c81
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/AttributeTraits.cpp
+1
-1
1 addition, 1 deletion
src/AttributeTraits.cpp
test/AttributeTraitsTests.cpp
+64
-0
64 additions, 0 deletions
test/AttributeTraitsTests.cpp
with
65 additions
and
1 deletion
src/AttributeTraits.cpp
+
1
−
1
View file @
b8a4401a
...
...
@@ -28,7 +28,7 @@ namespace hdbpp_internal
bool
AttributeTraits
::
isValid
()
const
noexcept
{
// ensure all the type information is valid
return
_attr_write_type
!=
Tango
::
WT_UNKNOWN
||
_attr_format
!=
Tango
::
FMT_UNKNOWN
||
return
_attr_write_type
!=
Tango
::
WT_UNKNOWN
&&
_attr_format
!=
Tango
::
FMT_UNKNOWN
&&
_attr_type
!=
Tango
::
DATA_TYPE_UNKNOWN
;
}
...
...
This diff is collapsed.
Click to expand it.
test/AttributeTraitsTests.cpp
+
64
−
0
View file @
b8a4401a
...
...
@@ -28,6 +28,7 @@ SCENARIO("Attribute format returns expected results", "[attribute-traits]")
GIVEN
(
"Constructed AttributeTraits as an Array"
)
{
AttributeTraits
traits
{
Tango
::
READ
,
Tango
::
SPECTRUM
,
Tango
::
DEV_BOOLEAN
};
REQUIRE
(
traits
.
isValid
());
WHEN
(
"Checking if traits are an array"
)
{
...
...
@@ -46,6 +47,7 @@ SCENARIO("Attribute format returns expected results", "[attribute-traits]")
GIVEN
(
"Constructed AttributeTraits as a Scalar"
)
{
AttributeTraits
traits
{
Tango
::
READ
,
Tango
::
SCALAR
,
Tango
::
DEV_BOOLEAN
};
REQUIRE
(
traits
.
isValid
());
WHEN
(
"Checking if traits are an array"
)
{
...
...
@@ -64,6 +66,7 @@ SCENARIO("Attribute format returns expected results", "[attribute-traits]")
GIVEN
(
"Constructed AttributeTraits as an Image"
)
{
AttributeTraits
traits
{
Tango
::
READ
,
Tango
::
IMAGE
,
Tango
::
DEV_BOOLEAN
};
REQUIRE
(
traits
.
isValid
());
WHEN
(
"Checking if traits are an array"
)
{
...
...
@@ -85,6 +88,7 @@ SCENARIO("Attribute write type returns expected results", "[attribute-traits]")
GIVEN
(
"Constructed AttributeTraits as ReadOnly"
)
{
AttributeTraits
traits
{
Tango
::
READ
,
Tango
::
SPECTRUM
,
Tango
::
DEV_BOOLEAN
};
REQUIRE
(
traits
.
isValid
());
WHEN
(
"Checking if traits are ReadOnly"
)
{
...
...
@@ -115,6 +119,7 @@ SCENARIO("Attribute write type returns expected results", "[attribute-traits]")
GIVEN
(
"Constructed AttributeTraits as WriteOnly"
)
{
AttributeTraits
traits
{
Tango
::
WRITE
,
Tango
::
SPECTRUM
,
Tango
::
DEV_BOOLEAN
};
REQUIRE
(
traits
.
isValid
());
WHEN
(
"Checking if traits are ReadOnly"
)
{
...
...
@@ -145,6 +150,7 @@ SCENARIO("Attribute write type returns expected results", "[attribute-traits]")
GIVEN
(
"Constructed AttributeTraits as ReadWrite"
)
{
AttributeTraits
traits
{
Tango
::
READ_WRITE
,
Tango
::
SPECTRUM
,
Tango
::
DEV_BOOLEAN
};
REQUIRE
(
traits
.
isValid
());
WHEN
(
"Checking if traits are ReadOnly"
)
{
...
...
@@ -175,6 +181,7 @@ SCENARIO("Attribute write type returns expected results", "[attribute-traits]")
GIVEN
(
"Constructed AttributeTraits as ReadWithWrite"
)
{
AttributeTraits
traits
{
Tango
::
READ_WITH_WRITE
,
Tango
::
SPECTRUM
,
Tango
::
DEV_BOOLEAN
};
REQUIRE
(
traits
.
isValid
());
WHEN
(
"Checking if traits are ReadOnly"
)
{
...
...
@@ -208,6 +215,7 @@ SCENARIO("Attribute traits accessors return construction time results", "[attrib
GIVEN
(
"Constructed AttributeTraits as a Read Only Array of type Tango::DEV_BOOLEAN"
)
{
AttributeTraits
traits
{
Tango
::
READ
,
Tango
::
SPECTRUM
,
Tango
::
DEV_BOOLEAN
};
REQUIRE
(
traits
.
isValid
());
WHEN
(
"Checking if traits type is Tango::DEV_BOOLEAN"
)
{
...
...
@@ -223,3 +231,59 @@ SCENARIO("Attribute traits accessors return construction time results", "[attrib
}
}
}
SCENARIO
(
"Attribute traits are invalid if not set with valid traits"
,
"[attribute-traits]"
)
{
GIVEN
(
"Constructing an AttributeTraits with no traits"
)
{
AttributeTraits
traits
;
WHEN
(
"Checking if traits type is valid"
)
{
THEN
(
"Result is false"
)
{
REQUIRE
(
!
traits
.
isValid
());
REQUIRE
(
traits
.
isInvalid
());
}
}
}
GIVEN
(
"Constructing an AttributeTraits with valid write trait"
)
{
AttributeTraits
traits
{
Tango
::
READ
,
Tango
::
FMT_UNKNOWN
,
Tango
::
DATA_TYPE_UNKNOWN
};
WHEN
(
"Checking if traits type is valid"
)
{
THEN
(
"Result is false"
)
{
REQUIRE
(
!
traits
.
isValid
());
REQUIRE
(
traits
.
isInvalid
());
}
}
}
GIVEN
(
"Constructed AttributeTraits with valid format and write traits"
)
{
AttributeTraits
traits
{
Tango
::
READ
,
Tango
::
SPECTRUM
,
Tango
::
DATA_TYPE_UNKNOWN
};
WHEN
(
"Checking if traits type is valid"
)
{
THEN
(
"Result is false"
)
{
REQUIRE
(
!
traits
.
isValid
());
REQUIRE
(
traits
.
isInvalid
());
}
}
}
GIVEN
(
"Constructed AttributeTraits with valid traits"
)
{
AttributeTraits
traits
{
Tango
::
READ
,
Tango
::
SPECTRUM
,
Tango
::
DEV_BOOLEAN
};
WHEN
(
"Checking if traits type is valid"
)
{
THEN
(
"Result is true"
)
{
REQUIRE
(
traits
.
isValid
());
REQUIRE
(
!
traits
.
isInvalid
());
}
}
}
}
\ No newline at end of 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