This project is a sample C++ project with Student
and Teacher
classes. The project is structured with CMake and tested using Google Test.
The framework is designed to be modular and easy to manage.
├── build ├── CMakeLists.txt ├── include │ ├── student │ │ └── student.hpp │ └── teacher │ └── teacher.hpp ├── src │ ├── CMakeLists.txt │ ├── main.cpp │ ├── student │ │ ├── CMakeLists.txt │ │ └── student.cpp │ └── teacher │ ├── CMakeLists.txt │ └── teacher.cpp └── test ├── CMakeLists.txt ├── studentTest │ ├── CMakeLists.txt │ └── test_student.cpp └── teacherTest ├── CMakeLists.txt └── test_teacher.cpp
- CMake (version 3.14 or higher)
- A C++ compiler (g++ or clang++)
- Google Test (will be automatically downloaded using CMake FetchContent)
1.Create a directory named build in the project root and navigate into it.
$mkdir -p build && cd build
2.Generate the project build files with CMake:
$cmake ..
3.Compile the project:
$make
1.Compile the tests:
$make studentTest teacherTest
-
Run the tests:
$ctest -V
Student: Contains student/student.hpp and student/student.cpp files.
Teacher: Contains teacher/teacher.hpp and teacher/teacher.cpp files.
The tests are located in the test directory and are written using Google Test.
studentTest: Contains test/studentTest/test_student.cpp file.
teacherTest: Contains test/teacherTest/test_teacher.cpp file.