Skip to content

Commit deda790

Browse files
committed
Add tests for expand.py
1 parent 839e3d7 commit deda790

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,21 @@ jobs:
9595
args: --workspace --no-fail-fast
9696
env:
9797
RUST_BACKTRACE: full
98+
99+
expander_test:
100+
strategy:
101+
fail-fast: false
102+
matrix:
103+
toolchain:
104+
- 1.42.0-x86_64-unknown-linux-gnu
105+
- stable-x86_64-unknown-linux-gnu
106+
107+
name: Expand_test (${{ matrix.toolchain }})
108+
runs-on: ubuntu-18.04
109+
110+
steps:
111+
- name: Checkout
112+
uses: actions/checkout@v2
113+
114+
- name: expand.py tests
115+
run: bash ./.github/workflows/test-expand.sh

.github/workflows/test-expand.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
TEST_MODULES=(convolution dsu fenwicktree lazysegtree math maxflow mincostflow modint scc segtree string twosat)
4+
TMP_PATH=$(mktemp -d)
5+
SCRIPT_DIR=$(cd $(dirname $0); pwd)
6+
TEST_FILE="test.rs"
7+
FILE_HEAD="fn main() {}"
8+
9+
for MODULE in ${TEST_MODULES[@]};do
10+
python3 $SCRIPT_DIR/../../expand.py $MODULE > $TMP_PATH/$TEST_FILE
11+
echo $FILE_HEAD >> $TMP_PATH/$TEST_FILE
12+
rustc $TMP_PATH/$TEST_FILE 2>/dev/null
13+
if [ $? -ne 0 ];then
14+
echo "Error compiling for $MODULE"
15+
exit 1
16+
else
17+
echo "Test passed($MODULE)"
18+
fi
19+
done

0 commit comments

Comments
 (0)