Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Prog2
/
labor_peldak
/
lab_05
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
6c9c8adc
authored
Mar 22, 2022
by
Szeberényi Imre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extra tesztek nullptr-rel megvalósított üres sztringre
parent
0327888c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletions
+14
-1
string5_test.cpp
+14
-1
No files found.
string5_test.cpp
View file @
6c9c8adc
/**
/**
* \file string5_test.cpp
* \file string5_test.cpp
*
*
* Tesztprogram az String osztály teszteléséhez.
* Tesztprogram az String osztály teszteléséhez.
...
@@ -112,6 +112,12 @@ int main() {
...
@@ -112,6 +112,12 @@ int main() {
const
String
c
=
a
;
const
String
c
=
a
;
String
d
=
c
;
// konstansból is megy?
String
d
=
c
;
// konstansból is megy?
EXPECT_STREQ
(
hello
,
d
.
c_str
())
<<
"Baj van a masolo konstruktorral"
<<
endl
;
EXPECT_STREQ
(
hello
,
d
.
c_str
())
<<
"Baj van a masolo konstruktorral"
<<
endl
;
String
d0
;
String
ures
=
d0
;
// üres sztringet is le tudja másolni?
EXPECT_EQ
((
size_t
)
0
,
ures
.
size
())
<<
"Baj van a string hosszaval"
<<
endl
;
/// Ellenőrizzük, hogy üres sztringet ("") kaptunk-e vissza?
EXPECT_STREQ
(
""
,
ures
.
c_str
())
<<
"Nem ures sztring jott letre"
<<
endl
;
}
ENDM
}
ENDM
#endif
#endif
...
@@ -144,6 +150,13 @@ int main() {
...
@@ -144,6 +150,13 @@ int main() {
c
=
d
;
// konstansból is megy?
c
=
d
;
// konstansból is megy?
EXPECT_EQ
(
c
.
size
(),
c
.
size
())
<<
"Ertekedas konstansbol: nem jo a hossz!"
<<
endl
;
EXPECT_EQ
(
c
.
size
(),
c
.
size
())
<<
"Ertekedas konstansbol: nem jo a hossz!"
<<
endl
;
EXPECT_STREQ
(
d
.
c_str
(),
c
.
c_str
())
<<
"Ertekadas konstansbol nem sikerult!"
<<
endl
;
EXPECT_STREQ
(
d
.
c_str
(),
c
.
c_str
())
<<
"Ertekadas konstansbol nem sikerult!"
<<
endl
;
String
d0
;
c
=
d0
;
// üres sztringet is le tudja másolni?
EXPECT_EQ
((
size_t
)
0
,
c
.
size
())
<<
"Baj van a string hosszaval"
<<
endl
;
/// Ellenőrizzük, hogy üres sztringet ("") kaptunk-e vissza?
EXPECT_STREQ
(
""
,
c
.
c_str
())
<<
"Nem ures sztring jott letre"
<<
endl
;
}
ENDM
}
ENDM
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment