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

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: about 2 months 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**.
- **Dependency Injection**: Enhances modularity and testability by decoupling components and providing dependencies externally.
- **Modularized Design**: Code is well-structured into **separate modules** for maintainability.
- **Design Patterns**:
- **Builder Pattern**: Used to facilitate **object creation** for unit testing.

### 🛠 **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**

- **Compiler Warnings**: Uses robust configuration for maximum warning levels and strict standard conformance.
- **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.
- **CMake**: 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
```