Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/swe-amr-abdelaziz/exam-simulator-cpp

A modern C++ console-based exam simulator with OOP, TDD, CI/CD, and Docker support.
https://github.com/swe-amr-abdelaziz/exam-simulator-cpp

builder-pattern clang-format continuous-integration cplusplus cpp data-structures-and-algorithms design-patterns docker dsa github-actions makefile modern-cpp object-oriented-programming oop standard-library tdd test-driven-development

Last synced: 1 day ago
JSON representation

A modern C++ console-based exam simulator with OOP, TDD, CI/CD, and Docker support.

Awesome Lists containing this project

README

        

# Exam Simulator in C++

A **console-based exam simulator** written in **modern C++**, designed with best practices in mind.
It follows **object-oriented principles**, applies **design patterns**, and leverages **test-driven development (TDD)** to ensure high code quality.

---

## 🚀 Features & Best Practices

### ✅ **Software Design Principles**
- **Object-Oriented Programming (OOP)**: Utilizes **encapsulation, inheritance, polymorphism, and abstraction**.
- **Modularized Design**: Code is well-structured into **separate modules** for maintainability.
- **Design Patterns**:
- **Builder Pattern**: Used for both **validators** and **question builders** to facilitate unit testing.
- **Abstraction**: Applied to encapsulate complexity and expose only necessary functionality, following one of the core principles of OOP.

### 🛠 **Modern C++ Features**
- **Smart Pointers**: Uses `std::unique_ptr` and `std::shared_ptr` for **automatic memory management**.
- **Move Semantics**: Improves performance by **avoiding unnecessary copies**.
- **Standard Library Usage**: Leverages **STL containers and algorithms** (`std::vector`, `std::optional`, etc.).
- **Lambda Expressions**: Used for cleaner, more concise code in various places.

### 🔍 **Code Quality & Static Analysis**
- **Code Formatting**: Uses `clang-format` for consistent styling.
- **Static Analysis**: Runs `cppcheck` to detect potential issues early.
- **File & Folder Naming Convention**: Ensures a consistent naming convention across the project.

### 📦 **Development & Automation**
- **Test-Driven Development (TDD)**: Implements **unit tests** to verify correctness.
- **Makefile**: Simplifies **compilation, running, testing, and memory leak checks**.
- **Shell Scripts**: Automates common tasks such as **code formatting, and generating test coverage reports**.

---

## 🛠 **CI/CD Pipeline**
This project employs **GitHub Actions** for automated **Continuous Integration (CI)**.

### 📜 **CI Jobs Workflow**
- **Check Files/Folders Naming Conventions**
- **Check Code Formatting**
- **Static Analysis with cppcheck and Upload cppcheck.xml**
- **Run Unit Tests**
- **Run Memory Leak Checks**
- **Generate Code Coverage and Upload Coverage Report**

### 🐳 **Docker Integration**
- The **Dockerfile** is included for demonstration.
- The CI pipeline uses a **pre-built image from Docker Hub** (`amrswe/cpp-utils`) to **optimize build times**.

---

## 📌 **How to Build & Run**
### **Build the Project**
```sh
make
```

### **Run the Project**
```sh
make run
```

### **Run Unit Tests**
```sh
make test
```

### **Print Help Menu**
```sh
make help
```