Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
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
TNL
tnl-dev
Commits
c58b3432
There was an error fetching the commit references. Please try again later.
Commit
c58b3432
authored
7 years ago
by
Jakub Klinkovský
Browse files
Options
Downloads
Patches
Plain Diff
Added missing operator! to String
parent
2f2f4664
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/TNL/String.cpp
+5
-0
5 additions, 0 deletions
src/TNL/String.cpp
src/TNL/String.h
+4
-1
4 additions, 1 deletion
src/TNL/String.h
src/UnitTests/StringTest.cpp
+10
-0
10 additions, 0 deletions
src/UnitTests/StringTest.cpp
with
19 additions
and
1 deletion
src/TNL/String.cpp
+
5
−
0
View file @
c58b3432
...
...
@@ -220,6 +220,11 @@ String :: operator bool () const
return
false
;
}
bool
String
::
operator
!
()
const
{
return
!
operator
bool
();
}
bool
String
::
operator
!=
(
const
char
*
str
)
const
{
return
!
operator
==
(
str
);
...
...
This diff is collapsed.
Click to expand it.
src/TNL/String.h
+
4
−
1
View file @
c58b3432
...
...
@@ -121,9 +121,12 @@ class String
//! Comparison operator
bool
operator
!=
(
const
char
*
)
const
;
//!
Retyping
operator
//!
Cast to bool
operator
operator
bool
()
const
;
//! Cast to bool with negation operator
bool
operator
!
()
const
;
//! Return length of the string
int
getLength
()
const
;
...
...
This diff is collapsed.
Click to expand it.
src/UnitTests/StringTest.cpp
+
10
−
0
View file @
c58b3432
...
...
@@ -106,6 +106,16 @@ TEST( StringTest, AdditionAssignmentOperator )
ASSERT_EQ
(
strcmp
(
string2
.
getString
(),
"stringstring2"
),
0
);
}
TEST
(
StringTest
,
CastToBoolOperator
)
{
String
string
;
EXPECT_TRUE
(
!
string
);
EXPECT_FALSE
(
string
);
string
.
setString
(
"foo"
);
EXPECT_TRUE
(
string
);
EXPECT_FALSE
(
!
string
);
}
TEST
(
StringTest
,
strip
)
{
EXPECT_EQ
(
String
(
"string"
).
strip
(),
String
(
"string"
)
);
...
...
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