forked from Ak0s/zerda-exam-cpp-orientation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest_Decryption.cpp
More file actions
32 lines (27 loc) · 814 Bytes
/
Test_Decryption.cpp
File metadata and controls
32 lines (27 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#define CATCH_CONFIG_MAIN
#include "Catch.hpp"
#include "Decryption.hpp"
TEST_CASE("Decrypts string by 3") {
std::string str = "abcd";
int shift = 3;
Decryption d;
REQUIRE(d.decrypt(str, shift) == "defg");
}
TEST_CASE("Decrypts string by 4, keeping capital letters") {
std::string str = "AbcD";
int shift = 4;
Decryption d;
REQUIRE(d.decrypt(str, shift) == "EfgH");
}
TEST_CASE("Decrypts string by 3 from the end of the alphabet, returns letters from the beginning of the alphabet") {
std::string str = "XyZ";
int shift = 3;
Decryption d;
REQUIRE(d.decrypt(str, shift) == "AbC");
}
TEST_CASE("Decrypts string by 2, keeping capital letters, spaces and numbers intact") {
std::string str = "AbcD E 2";
int shift = 2;
Decryption d;
REQUIRE(d.decrypt(str, shift) == "CdeF G 2");
}