Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Prog2
/
szorgalmi_feladatok
/
stringpool
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
83104441
authored
Nov 28, 2022
by
Karsa Zoltán István
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test.cpp
parent
3dbd73f6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
4 deletions
+61
-4
.gitignore
+3
-2
rstring.h
+4
-2
test.cpp
+54
-0
No files found.
.gitignore
View file @
83104441
...
...
@@ -32,4 +32,5 @@
*.app
main
megoldas
\ No newline at end of file
megoldas
.vscode
\ No newline at end of file
rstring.h
View file @
83104441
#ifndef RSTRING_H
#define RSTRING_H
#include <cstdio>
class
RString
{
public
:
// Létrehoz a megadott kapacitással egy karaktertömböt
// A tömb első helyére egy \0-t rak
RString
(
size_t
_
capacity
);
RString
(
size_t
capacity
);
// Létrehoz egy karaktertömböt strlen(str) + 1 mérettel
// majd odamásolja str tartalmát
RString
(
const
char
*
str
);
// Létrehoz egy karaktertömböt capacity mérettel,
// majd odamásolja az str string-et
// Ha a string nem fér bele, eldobja a neptun-kódodat
RString
(
const
char
*
str
,
size_t
capacity
)
RString
(
const
char
*
str
,
size_t
capacity
)
;
// Megadja a string méretét (strlen)
size_t
size
();
// Megadja a karaktertömb kapacitását
...
...
test.cpp
0 → 100644
View file @
83104441
/**
* \file test.cpp
*
* Cipher nevű szorgalmi feladat tesztjei gtest_lite eszközeivel megvalósítva
* A szorgalmi feladat megoldásához ezt az állományt nem kell beadni (feltölteni).
*
* A ELKESZULT makró vezérli az egyes tesztesetek fordítását, ezzel lehetővé válik
* hogy kisebb lépésekben teszteljünk.
*
*/
#include <iostream>
#include "gtest_lite.h"
#include "memtrace.h"
#include "rstring.h"
#include "pool.h"
#define ELKESZULT 1
/* ELKESZULT makró:
<= 5: RString tesztjei
>= 10: Összes teszt
*/
int
main
()
{
GTINIT
(
std
::
cin
);
#if ELKESZULT > 0
//Caesar titkosítás ellenőrzése
TEST
(
RString
,
konstruktorok
)
{
RString
a
(
100
);
EXPECT_STREQ
(
""
,
a
);
EXPECT_EQ
(
100
,
a
.
capacity
());
EXPECT_EQ
(
0
,
a
.
size
());
RString
b
(
"alma"
);
EXPECT_STREQ
(
"alma"
,
b
);
EXPECT_EQ
(
5
,
b
.
capacity
());
EXPECT_EQ
(
4
,
b
.
size
());
RString
c
(
"alma"
,
10
);
EXPECT_STREQ
(
"alma"
,
b
);
EXPECT_EQ
(
10
,
c
.
capacity
());
EXPECT_EQ
(
4
,
c
.
size
());
}
END
#endif
if
(
ELKESZULT
<
10
)
ADD_FAILURE
()
<<
"
\n
Nem futott minden teszteset!"
<<
std
::
endl
;
GTEND
(
std
::
cerr
);
return
0
;
}
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