-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.cpp
72 lines (69 loc) · 1.79 KB
/
test.cpp
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>
#include "nuttiest/nuttiest.hpp"
#include "cipherFunctions.cpp"
using namespace std;
using namespace nuttiest;
int main() {
section("indexChar") {
unit_test("\'C\' returns (3)") {
assert_eq(3, indexChar('C'));
}
unit_test("\'Z\' returns (26)") {
assert_eq(26, indexChar('Z'));
}
unit_test("\' \' returns (27)") {
assert_eq(27, indexChar(' '));
}
}
section("isInAlphabetIndex") {
unit_test("\"AAA\" is all caps") {
string str {"AAA"};
assert_eq(true, isInAlphabetIndex(str));
}
unit_test("\"AAa\" is not all caps") {
string str {"AAa"};
assert_eq(false, isInAlphabetIndex(str));
}
}
section("charShiftRight") {
unit_test("(2) and \'A\' returns \'C\'") {
assert_eq('C', charShiftRight(2, 'A'));
}
unit_test("(25) and \'C\' returns \'A\'") {
assert_eq('A', charShiftRight(25, 'C'));
}
}
section("charShiftLeft") {
unit_test("(2) and \'C\' returns \'A\'") {
assert_eq('A', charShiftLeft(2, 'C'));
}
unit_test("(25) and \'B\' returns \'D\'") {
assert_eq('D', charShiftLeft(25, 'B'));
}
}
section("encrypt") {
unit_test("(4) \"ABC\" returns \"EFG\"") {
string str {"ABC"};
encrypt(4, str);
assert_eq("EFG", str);
}
unit_test("(25) and \"BLACK MAGIC\" returns \" JZAIYKZEGA\"") {
string str {"BLACK MAGIC"};
encrypt(25, str);
assert_eq(" JZAIYKZEGA", str);
}
}
section("decrypt") {
unit_test("(4) \"EFG\" returns \"ABC\"") {
string str {"EFG"};
decrypt(4, str);
assert_eq("ABC", str);
}
unit_test("(25) and \" JZAIYKZEGA\" returns \"BLACK MAGIC\"") {
string str {" JZAIYKZEGA"};
decrypt(25, str);
assert_eq("BLACK MAGIC", str);
}
}
summary();
}