Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
EFanZh committed Jan 7, 2025
1 parent 091218c commit 304920f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- run: >-
cargo xtask coverage
--cmake-toolchain-file "$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
--llvm-version 14
--llvm-version 18
-o coverage/lcov.info
- uses: codecov/codecov-action@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/progress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- run: sudo apt-get install --no-install-recommends libfontconfig-dev
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
clippy:
runs-on: ${{ matrix.os }}
steps:
- if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get install --no-install-recommends libfontconfig-dev
- uses: actions/checkout@v4
- run: rustup update
- run: cargo clippy --workspace --all-targets --all-features -- -D warnings
Expand All @@ -28,6 +30,8 @@ jobs:
tests:
runs-on: ${{ matrix.os }}
steps:
- if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get install --no-install-recommends libfontconfig-dev
- uses: actions/checkout@v4
- run: rustup update
- run: cargo test --workspace
Expand Down
3 changes: 3 additions & 0 deletions c++/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ Checks: >-
-altera-struct-pack-align,
-altera-unroll-loops,
-bugprone-easily-swappable-parameters,
-cppcoreguidelines-avoid-do-while,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-fuchsia-default-arguments-calls,
-llvm-header-guard,
-llvm-include-order,
-llvmlibc-callee-namespace,
-llvmlibc-implementation-in-namespace,
-llvmlibc-inline-function-decl,
-llvmlibc-restrict-system-libc-headers,
-misc-include-cleaner,
-misc-no-recursion,
-modernize-use-trailing-return-type,
-readability-convert-member-functions-to-static,
Expand Down
26 changes: 17 additions & 9 deletions c++/tests/leet-code/test-utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace leet_code::test_utilities {
template <class C>
std::tuple<std::vector<std::unique_ptr<data_structures::list_node::ListNode>>, data_structures::list_node::ListNode *>
make_list(C &&values) {
make_list(const C &values) {
using data_structures::list_node::ListNode;
using std::unique_ptr;
using std::vector;
Expand All @@ -24,7 +24,7 @@ make_list(C &&values) {
auto *head = static_cast<ListNode *>(nullptr);
auto *tail = &head;

for (const auto &value : values) {
for (const auto value : values) {
*tail = buffer.emplace_back(std::make_unique<ListNode>(value)).get();
tail = &(*tail)->next;
}
Expand All @@ -33,7 +33,7 @@ make_list(C &&values) {
}

template <class T, class C>
std::tuple<std::vector<std::unique_ptr<T>>, T *> make_tree(C &&values) {
std::tuple<std::vector<std::unique_ptr<T>>, T *> make_tree(const C &values) {
using std::deque;
using std::unique_ptr;
using std::vector;
Expand All @@ -52,10 +52,14 @@ std::tuple<std::vector<std::unique_ptr<T>>, T *> make_tree(C &&values) {
auto *target = root;

for (; it != it_end; ++it) {
if (*it) {
target->left = buffer.emplace_back(std::make_unique<T>(**it)).get();
{
const auto value = *it;

queue.emplace_back(target->left);
if (value) {
target->left = buffer.emplace_back(std::make_unique<T>(*value)).get();

queue.emplace_back(target->left);
}
}

++it;
Expand All @@ -64,10 +68,14 @@ std::tuple<std::vector<std::unique_ptr<T>>, T *> make_tree(C &&values) {
break;
}

if (*it) {
target->right = buffer.emplace_back(std::make_unique<T>(**it)).get();
{
const auto value = *it;

if (value) {
target->right = buffer.emplace_back(std::make_unique<T>(*value)).get();

queue.emplace_back(target->right);
queue.emplace_back(target->right);
}
}

target = queue.front();
Expand Down

0 comments on commit 304920f

Please sign in to comment.