Skip to content

Commit

Permalink
Merge branch 'test-suite'
Browse files Browse the repository at this point in the history
  • Loading branch information
gvnnz committed Mar 30, 2024
2 parents 57d382f + 753d331 commit 154f1e3
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Continuous integration

on: [push, pull_request]

jobs:
linux:
name: CI
runs-on: ubuntu-20.04
timeout-minutes: 60
steps:
- name: Download repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Generate Makefile
run: cmake -S . -B build/ -G "Unix Makefiles"

- name: Build
run: cmake --build build/ -j 2

- name: Run tests
run: ./build/tests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build/
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.25)

project(geompp LANGUAGES CXX)

add_executable(tests
src/audioBuffer.cpp
tests/audioBuffer.cpp)
target_include_directories(tests PRIVATE ${CMAKE_SOURCE_DIR})
target_compile_features(tests PRIVATE cxx_std_20)

include(cmake/CPM.cmake)

CPMAddPackage(
NAME catch2
GITHUB_REPOSITORY catchorg/Catch2
VERSION 3.5.3)

if(catch2_ADDED)
target_link_libraries(tests PRIVATE Catch2::Catch2WithMain)
endif()
24 changes: 24 additions & 0 deletions cmake/CPM.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-License-Identifier: MIT
#
# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors

set(CPM_DOWNLOAD_VERSION 0.38.7)
set(CPM_HASH_SUM "83e5eb71b2bbb8b1f2ad38f1950287a057624e385c238f6087f94cdfc44af9c5")

if(CPM_SOURCE_CACHE)
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
else()
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
endif()

# Expand relative path. This is important if the provided path contains a tilde (~)
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)

file(DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM}
)

include(${CPM_DOWNLOAD_LOCATION})
7 changes: 3 additions & 4 deletions tests/audioBuffer.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#include "../src/core/audioBuffer.h"
#include <catch2/catch.hpp>
#include <memory>
#include "src/audioBuffer.hpp"
#include <catch2/catch_test_macros.hpp>

TEST_CASE("AudioBuffer")
{
using namespace giada::m;
using namespace mcl;

static const int BUFFER_SIZE = 4096;

Expand Down

0 comments on commit 154f1e3

Please sign in to comment.