Skip to content

Commit d4f4327

Browse files
author
Cameron Custer
committed
tests/infra: move to c++23 (std pins, g++-14 in CI, deducing this in tests)
1 parent 1986a8a commit d4f4327

25 files changed

Lines changed: 93 additions & 81 deletions

.github/actions/setup/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ runs:
99
chmod +x llvm.sh
1010
sudo ./llvm.sh 22
1111
sudo apt-get update
12-
sudo apt-get install -y clang-format-22 clang-tidy-22
12+
sudo apt-get install -y clang-format-22 clang-tidy-22 g++-14
13+
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
1314
clang-22 --version
1415
clang-format-22 --version
1516
clang-tidy-22 --version
17+
g++ --version

.github/workflows/programming_team_code_ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ jobs:
1212
- uses: actions/checkout@v1
1313
- name: Set up Python
1414
uses: actions/setup-python@v1
15+
- name: Install g++-14
16+
run: |
17+
sudo apt-get update
18+
sudo apt-get install -y g++-14
19+
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
20+
g++ --version
1521
- name: Install dependencies
1622
run: |
1723
pip install "setuptools<81"
@@ -53,6 +59,12 @@ jobs:
5359
runs-on: ubuntu-latest
5460
steps:
5561
- uses: actions/checkout@v4
62+
- name: Install g++-14
63+
run: |
64+
sudo apt-get update
65+
sudo apt-get install -y g++-14
66+
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
67+
g++ --version
5668
- name: g++ with gcc
5769
run: make --directory=tests/ compile_gcc
5870

.verify-helper/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
CXX = "g++"
33
CXXFLAGS = [
44
"-O2",
5-
"-std=c++20",
5+
"-std=c++23",
66
"-fsanitize=address,undefined",
77
"-fno-sanitize-recover=all",
88
"-fstack-protector",

tests/.config/.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,5 @@ SpacesInCStyleCastParentheses: false
8888
SpacesInContainerLiterals: false
8989
SpacesInParentheses: false
9090
SpacesInSquareBrackets: false
91-
Standard: c++20
91+
Standard: Latest
9292
...

tests/.config/.gcc_compile_flags

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
-Wduplicated-cond
1111
-Werror
1212
-O2
13-
-std=c++20
13+
-std=c++23

tests/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
help:
22
@echo "command | explanation"
33
@echo "------------------------------------ | -----------"
4-
@echo "make compile_gcc | compile all tests with -std=c++20 for warnings"
4+
@echo "make compile_gcc | compile all tests with -std=c++23 for warnings"
55
@echo " |"
6-
@echo "make compile_clang | compile all tests with clang, -std=c++20 for warnings"
6+
@echo "make compile_clang | compile all tests with clang, -std=c++23 for warnings"
77
@echo " |"
88
@echo "make grep_clangformat_cppcheck | various greps to catch certain things, clang-format, cppcheck"
99
@echo " |"

tests/library_checker_aizu_tests/cd_asserts.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ void cd_asserts(vector<vi> adj) {
55
vi naive_par_decomp(sz(adj), -1);
66
vi par = cd(adj, [&](int cent) -> void {
77
assert(decomp_size[cent] == -1);
8-
auto dfs = [&](auto&& self, int u, int p) -> int {
8+
auto dfs = [&](this auto&& self, int u, int p) -> int {
99
if (p != -1) naive_par_decomp[u] = cent;
1010
int sub_size = 1;
1111
for (int v : adj[u])
12-
if (v != p) sub_size += self(self, v, u);
12+
if (v != p) sub_size += self(v, u);
1313
return sub_size;
1414
};
15-
decomp_size[cent] = dfs(dfs, cent, -1);
15+
decomp_size[cent] = dfs(cent, -1);
1616
for (int u : adj[cent]) {
17-
int sz_subtree = dfs(dfs, u, cent);
17+
int sz_subtree = dfs(u, cent);
1818
assert(1 <= sz_subtree &&
1919
2 * sz_subtree <= decomp_size[cent]);
2020
}

tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ int main() {
1515
cout << sz(ch) << '\n';
1616
int curr_time = 0;
1717
vi node_to_time(sz(ch), -1);
18-
auto dfs = [&](auto&& self, int u, int p) -> void {
18+
auto dfs = [&](this auto&& self, int u, int p) -> void {
1919
node_to_time[u] = curr_time++;
2020
cout << (p == -1 ? p : node_to_time[p]) << " "
2121
<< pt.p[u].mn_idx << " "
2222
<< pt.p[u].mn_idx + pt.p[u].len - 1 << " "
2323
<< (pt.p[u].is_join || empty(ch[u]) ? "linear"
2424
: "prime")
2525
<< '\n';
26-
for (int v : ch[u]) self(self, v, u);
26+
for (int v : ch[u]) self(v, u);
2727
};
28-
dfs(dfs, root, -1);
28+
dfs(root, -1);
2929
return 0;
3030
}

tests/library_checker_aizu_tests/dsu/kruskal_tree_aizu.test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ int main() {
3030
rep(i, n, kt.id) mst_sum += weight[i];
3131
vi depth(2 * n);
3232
vi actual_par(2 * n, -1);
33-
auto dfs = [&](auto&& self, int v) -> void {
33+
auto dfs = [&](this auto&& self, int v) -> void {
3434
for (int u : kt.g[v]) {
3535
depth[u] = 1 + depth[v];
3636
actual_par[u] = v;
37-
self(self, u);
37+
self(u);
3838
}
3939
};
40-
dfs(dfs, kt.id - 1);
40+
dfs(kt.id - 1);
4141
rep(i, 0, n) rep(j, i + 1, n) {
4242
int u = i, v = j;
4343
while (u != v)

tests/library_checker_aizu_tests/edge_cd_asserts.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#pragma once
22
auto edge_cd_asserts = [&](int cent, int split) -> void {
33
assert(0 < split && split < sz(adj[cent]));
4-
auto dfs = [&](auto&& self, int u, int p) -> int {
4+
auto dfs = [&](this auto&& self, int u, int p) -> int {
55
int siz = 1;
66
for (int v : adj[u])
7-
if (v != p) siz += self(self, v, u);
7+
if (v != p) siz += self(v, u);
88
return siz;
99
};
10-
int sz_all = dfs(dfs, cent, -1);
10+
int sz_all = dfs(cent, -1);
1111
assert(sz_all >= 3);
1212
array<int, 2> cnts = {0, 0};
1313
array<int, 2> max_cnt = {0, 0};
1414
array<int, 2> number_of_cnts = {0, 0};
1515
rep(i, 0, sz(adj[cent])) {
16-
int sz_subtree = dfs(dfs, adj[cent][i], cent);
16+
int sz_subtree = dfs(adj[cent][i], cent);
1717
assert(2 * sz_subtree <= sz_all);
1818
cnts[i < split] += sz_subtree;
1919
max_cnt[i < split] =

0 commit comments

Comments
 (0)