You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 18, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: docs/reference/cpp/tools.md
+10-96Lines changed: 10 additions & 96 deletions
Original file line number
Diff line number
Diff line change
@@ -14,94 +14,6 @@ CMake is a powerfull build automation tool that makes compiling code for large p
14
14
files a lot easier. Steps 1-3 of the [official tutorial](https://cmake.org/cmake/help/latest/guide/tutorial/index.html){target=_blank}
15
15
are great for understanding the basics.
16
16
17
-
## GDB
18
-
19
-
The [GNU Project Debugger](https://www.sourceware.org/gdb/){target=_blank} is the most commonly debugger for the C
20
-
language family.
21
-
VSCode also has a degree of integration with GDB that allows an easy to use GUI. This [GDB cheat sheet](https://darkdust.net/files/GDB%20Cheat%20Sheet.pdf){target=_blank}
22
-
has all the GDB comands you will need to know. Be aware the VSCode has GUI buttons for some of these commands that are
23
-
easier to use.
24
-
25
-
<!-- TODO Add examples with screenshots -->
26
-
27
-
## GoogleTest
28
-
29
-
[GoogleTest](https://github.com/google/googletest){target=_blank} is the C++ unit testing framework we will be using.
30
-
The [GoogleTest Primer](https://google.github.io/googletest/primer.html){target=_blank} is a good place to start.
31
-
32
-
??? example
33
-
34
-
=== "Cached Fibonacci Program"
35
-
36
-
```C++ title="cached_fib.h"
37
-
#include <vector>
38
-
class CachedFib {
39
-
public:
40
-
void CachedFib(int n);
41
-
int getFib(int n);
42
-
private:
43
-
std::vector<int> cache;
44
-
}
45
-
```
46
-
47
-
```C++ title="cached_fib.cpp"
48
-
#include <iostream>
49
-
#include <vector>
50
-
#include "cached_fib.h"
51
-
52
-
void CachedFib::CachedFib(int n) {
53
-
cache.push_back(0);
54
-
cache.push_back(1);
55
-
for (int i = 2; i < n; i++) {
56
-
cache.push_back(cache[i - 1] + cache[i - 2]);
57
-
}
58
-
}
59
-
60
-
int CachedFib::getFib(int n) {
61
-
if (cache.size() < n) {
62
-
for (int i = cache.size(); i < n; i++) {
63
-
cache.push_back(cache[i-1] + cache[i-2]);
64
-
}
65
-
}
66
-
std::cout << cache[n - 1] << std::endl;
67
-
}
68
-
```
69
-
70
-
=== "Test Cached Fibonacci Program"
71
-
72
-
```C++ title="test_cached_fib.cpp"
73
-
74
-
#include "cached_fib.h"
75
-
#include "gtest/gtest.h"
76
-
77
-
CachedFib::testFib;
78
-
79
-
class TestFib : public ::testing::Test {
80
-
protected:
81
-
void Setup override {
82
-
// Every time a test is started, testFib is reinitialized with a constructor parameter of 5
83
-
testFib = CachedFib(5);
84
-
}
85
-
}
86
-
87
-
TEST_F(TestFib, TestBasic) {
88
-
ASSERT_EQ(getFib(5), 3) << "5th fibonacci number must be 3!";
89
-
}
90
-
91
-
// more tests
92
-
93
-
```
94
-
95
-
<!-- ## Google Mock Not sure if we're going to use this yet -->
96
-
97
-
## Google Protocol Buffer
98
-
99
-
[Google Protocol Buffer](https://developers.google.com/protocol-buffers){target=_blank} (Protobuf) is a portable data serialization
100
-
method. We use it over other methods like JSON and XML because it produces smaller binaries, an important consideration
101
-
when sending data across an ocean. Unfortunately, there does not seem to be a easy to follow tutorial for using them,
102
-
but here are the [C++ basics](https://developers.google.com/protocol-buffers/docs/cpptutorial){target=_blank}. The page
103
-
is quite dense and can be hard to follow, so do not worry if you do not understand it.
104
-
105
17
## Clang
106
18
107
19
In its most basic form, [Clang](https://clang.llvm.org/){target=_blank} is a compiler for the C language family.
@@ -127,17 +39,18 @@ as you hit save.
127
39
128
40
## GDB
129
41
130
-
The [GNU Project Debugger](https://www.sourceware.org/gdb/) is the most commonly debugger for the C language family.
131
-
VSCode also has a degree of integration with GDB that allows an easy to use GUI. This [GDB cheat sheet](https://darkdust.net/files/GDB%20Cheat%20Sheet.pdf)
42
+
The [GNU Project Debugger](https://www.sourceware.org/gdb/){target=_blank} is the most common debugger for the C
43
+
language family.
44
+
VSCode also has a degree of integration with GDB that allows an easy to use GUI. This [GDB cheat sheet](https://darkdust.net/files/GDB%20Cheat%20Sheet.pdf){target=_blank}
132
45
has all the GDB comands you will need to know. Be aware the VSCode has GUI buttons for some of these commands that are
133
46
easier to use.
134
47
135
48
<!-- TODO Add examples with screenshots -->
136
49
137
50
## GoogleTest
138
51
139
-
[GoogleTest](https://github.com/google/googletest) is the C++ unit testing framework we will be using.
140
-
The [GoogleTest Primer](https://google.github.io/googletest/primer.html) is a good place to start.
52
+
[GoogleTest](https://github.com/google/googletest){target=_blank} is the C++ unit testing framework we will be using.
53
+
The [GoogleTest Primer](https://google.github.io/googletest/primer.html){target=_blank} is a good place to start.
141
54
142
55
??? example
143
56
@@ -218,16 +131,17 @@ The [GoogleTest Primer](https://google.github.io/googletest/primer.html) is a go
218
131
TEST_F(TestFib, TestBasic) { ASSERT_EQ(testFib.getFib(5), 3) << "5th fibonacci number must be 3!"; }
219
132
220
133
// more tests
221
-
222
134
```
223
135
136
+
<!-- ## Google Mock Not sure if we're going to use this yet -->
137
+
224
138
## Google Protocol Buffer
225
139
226
-
[Google Protocol Buffer](https://developers.google.com/protocol-buffers) (Protobuf) is a portable data serialization
140
+
[Google Protocol Buffer](https://developers.google.com/protocol-buffers){target=_blank} (Protobuf) is a portable data serialization
227
141
method. We use it over other methods like JSON and XML because it produces smaller binaries, an important consideration
228
142
when sending data across an ocean. Unfortunately, there does not seem to be a easy to follow tutorial for using them,
229
-
but here are the [C++ basics](https://developers.google.com/protocol-buffers/docs/cpptutorial). The page is quite dense
230
-
and can be hard to follow, so do not worry if you do not understand it.
143
+
but here are the [C++ basics](https://developers.google.com/protocol-buffers/docs/cpptutorial){target=_blank}. The page
144
+
is quite dense and can be hard to follow, so do not worry if you do not understand it.
0 commit comments