From 473d68914151d5d975458416d8f1df6c2a767c32 Mon Sep 17 00:00:00 2001 From: Francesco Cavaliere <32930037+c4v4@users.noreply.github.com> Date: Fri, 26 Apr 2024 10:55:17 +0200 Subject: [PATCH] Added Ubuntu CI (#10) --- .github/workflows/c-cpp.yml | 19 ++++++++++++++----- README.md | 2 ++ include/radix_sort.hpp | 4 ++-- include/sort.hpp | 2 +- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 8404fe9..3c2dd56 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -46,6 +46,10 @@ jobs: - name: Install lcov if: matrix.cpp_compiler == 'g++' run: sudo apt-get install lcov + + - name: Make coverage directory + if: matrix.cpp_compiler == 'g++' + run: mkdir -p ${{ github.workspace }}/coverage - name: Build coverage report if: matrix.cpp_compiler == 'g++' @@ -54,8 +58,8 @@ jobs: - uses: actions/upload-artifact@v4 if: matrix.cpp_compiler == 'g++' with: - name: coverage - path: ${{ github.workspace }}/coverage/tests_*_cov.info + name: coverage_${{ matrix.build_type }}_${{ matrix.cpp_compiler }} + path: ${{ github.workspace }}/coverage/tests_${{ matrix.build_type }}_cov.info Coverage: @@ -64,19 +68,24 @@ jobs: needs: build steps: - uses: actions/checkout@v4 + + - name: Make coverage directory + run: mkdir -p ${{ github.workspace }}/coverage - name: Download artifact uses: actions/download-artifact@v4 with: - name: coverage + pattern: coverage_* + merge-multiple: true + path: ${{ github.workspace }}/coverage - name: Install lcov run: sudo apt-get install lcov - name: Merge Release and Debug reports - run: lcov -a ${{ github.workspace }}/coverage/tests_release_cov.info -a ${{ github.workspace }}/coverage/tests_debug_cov.info -o ${{ github.workspace }}/coverage/tests_cov.info + run: lcov -a ${{ github.workspace }}/coverage/tests_Release_cov.info -a ${{ github.workspace }}/coverage/tests_Debug_cov.info -o ${{ github.workspace }}/coverage/tests_cov.info - - name: Only select CFT library files + - name: Only select YASL library files run: lcov -e ${{ github.workspace }}/coverage/tests_cov.info yasl/include/*/ -o ${{ github.workspace }}/coverage/tests_cov.info - name: Upload coverage reports to Codecov diff --git a/README.md b/README.md index cd12371..959f6fa 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,12 @@ SPDX-License-Identifier: MIT # Yet Another Sorting Library [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Ubuntu CI](https://github.com/c4v4/yasl/actions/workflows/c-cpp.yml/badge.svg?branch=main)](https://github.com/c4v4/yasl/actions/workflows/c-cpp.yml) [![codecov](https://codecov.io/gh/c4v4/yasl/graph/badge.svg?token=AYB5IHFSCD)](https://codecov.io/gh/c4v4/yasl) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/f82fe574441d4c26b7ed304ad519ed2a)](https://app.codacy.com/gh/c4v4/yasl/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![REUSE status](https://api.reuse.software/badge/github.com/c4v4/yasl)](https://api.reuse.software/info/github.com/c4v4/yasl) +**!!! THIS REPO IS WORK IN PROGRESS !!!** A repo where I fool around with different sorting algorithms. I wanted to see if I could find an algorithm faster than `std::sort` when I can make some extra assumptions. diff --git a/include/radix_sort.hpp b/include/radix_sort.hpp index 387467d..09a9a3f 100644 --- a/include/radix_sort.hpp +++ b/include/radix_sort.hpp @@ -107,7 +107,7 @@ static void radix_sort_msd(C1& cont, C2& buff, K key = {}, uint8_t b = sizeof(sort::key_t) - 1) { - constexpr uint8_t n_bytes = sizeof(sort::key_t); + assert(b < sizeof(sort::key_t)); assert(cav::size(cont) <= cav::size(buff)); auto buff_span = make_span(std::begin(buff), cav::size(cont)); @@ -141,7 +141,7 @@ static void radix_sort_msd(C1& cont, } assert(ssrng.beg < ssrng.end); - if (b - 1 == 0){ + if (b - 1 == 0) { assert_sorted(sub_cont, key); continue; } diff --git a/include/sort.hpp b/include/sort.hpp index 2b76523..df800f9 100644 --- a/include/sort.hpp +++ b/include/sort.hpp @@ -40,7 +40,7 @@ struct Sorter { SorterData& operator=(SorterData const&) = delete; SorterData& operator=(SorterData&&) noexcept = default; - SorterData(alloc_type const& alc) + explicit SorterData(alloc_type const& alc) : alloc_type(alc) { }