WanxiaJaneYang / BLOCK14PG

0 stars 0 forks source link

BLOCK14PG

Brief project description or introduction here.

Table of Contents

File Structure

Tech Stack

BLOCK14PG Project: Build and Test

Introduction

Welcome to the BLOCK14PG project repository. This document provides instructions on how to build the main project source code and execute unit tests.

Prerequisites

Building the Main Project

  1. Navigate to the src directory:

    cd path/to/BLOCK14PG/src
  2. Create a build directory (if it doesn't exist) and navigate into it:

    mkdir build
    cd build
  3. Configure the project using CMake. Adapt the generator as per your build system:

    cmake .. -G "MinGW Makefiles"  # For Windows with MinGW
  4. Compile the project:

    mingw32-make   # For Windows with MinGW
  5. The compiled executable can be found within the build directory. Navigate there to run the program.

Setting Up and Running Unit Tests

  1. Make sure the prerequisites mentioned above are met.

  2. Add your test case in the valid_test_cases folder or invalid_test_cases folder.

    • Ensure you follow the naming convention.
    • Place the expected result text file in the same folder. Keep the tag table in alphabetical order and add a blank line before each Block title.
  3. For Unit Test Contributors:

    • Edit the project's root CMakeLists.txt to include your test executable:

      # Add test executable
      add_executable(runUnitTests tests/test_main.cpp ${source})
      target_link_libraries(runUnitTests gtest gtest_main)
    • Create or modify tests/test_main.cpp or another preferred file name.

    • Navigate to the googletest directory, then to build. If the build directory doesn't exist, create it:

      cd googletest
      mkdir -p build
      cd build
    • Configure the project using CMake:

      cmake ..
    • Compile the tests:

      make
    • Run the tests:

      ./runUnitTests

Static Code Analysis - Cppcheck

We've integrated Cppcheck for static code analysis to maintain code quality. Before committing any changes, it's recommended to run Cppcheck locally to spot any potential issues.

How to run Cppcheck locally:

  1. Install Cppcheck on your machine. For most platforms, you can find installation instructions on the official Cppcheck website.

  2. Navigate to your project directory in the terminal or command prompt.

  3. Use the following command to run Cppcheck:

    • For src/ with C++11 standard:
      cppcheck --enable=all --std=c++11 src/
    • For tests/ with C++17 standard:
      cppcheck --enable=all --std=c++17 tests/

Make sure you've resolved any warnings or errors flagged by Cppcheck before making a commit.

Notes:

Continuous Integration (CI) and Testing

In BLOCK14PG, we use GitHub Actions to ensure that our codebase remains consistent and reliable. This helps us detect and fix issues early in the development process, improving the overall quality of our software.

CI Configuration

Our CI is configured to test the code in the following environments:

To see the CI status for recent commits, navigate to the Actions tab in our GitHub repository.

Collaborator Guidelines

For collaborators:

Feedback and Troubleshooting

If you encounter an issue or have suggestions, please discuss it with the team or mention it in our internal communication channels.

To be added: "Getting Started", "Installation", "Usage", etc.