Skip to content

Commit 9a6a2b7

Browse files
committed
Test parsing existentials
1 parent 89d9f86 commit 9a6a2b7

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,33 @@ jobs:
2424
runs-on: ubuntu-latest
2525
permissions:
2626
contents: read
27+
env:
28+
COAR_IMAGE: ghcr.io/hiroshi-unno/coar@sha256:73144ed27a02b163d1a71b41b58f3b5414f12e91326015600cfdca64ff19f011
2729
steps:
2830
- uses: actions/checkout@v4
2931
- uses: ./.github/actions/setup-z3
32+
- name: Setup thrust-pcsat-wrapper
33+
run: |
34+
docker pull "$COAR_IMAGE"
35+
36+
cat <<"EOF" > thrust-pcsat-wrapper
37+
#!/bin/bash
38+
39+
smt2=$(mktemp -p . --suffix .smt2)
40+
trap "rm -f $smt2" EXIT
41+
cp "$1" "$smt2"
42+
out=$(
43+
docker run --rm -v "$PWD:/mnt" -w /root/coar "$COAR_IMAGE" \
44+
main.exe -c ./config/solver/pcsat_tbq_ar.json -p pcsp "/mnt/$smt2"
45+
)
46+
exit_code=$?
47+
echo "${out%,*}"
48+
exit "$exit_code"
49+
EOF
50+
chmod +x thrust-pcsat-wrapper
51+
52+
mkdir -p ~/.local/bin
53+
mv thrust-pcsat-wrapper ~/.local/bin/thrust-pcsat-wrapper
3054
- run: rustup show
3155
- uses: Swatinem/rust-cache@v2
3256
- run: cargo test

tests/ui/fail/annot_exists.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//@error-in-other-file: Unsat
2+
//@compile-flags: -C debug-assertions=off
3+
//@rustc-env: THRUST_SOLVER=thrust-pcsat-wrapper
4+
5+
#[thrust::trusted]
6+
#[thrust::callable]
7+
fn rand() -> i32 { unimplemented!() }
8+
9+
#[thrust::requires(true)]
10+
#[thrust::ensures(exists x:int. result == 2 * x)]
11+
fn f() -> i32 {
12+
let x = rand();
13+
x + x + x
14+
}
15+
16+
fn main() {}

tests/ui/pass/annot_exists.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//@check-pass
2+
//@compile-flags: -C debug-assertions=off
3+
//@rustc-env: THRUST_SOLVER=thrust-pcsat-wrapper
4+
5+
#[thrust::trusted]
6+
#[thrust::callable]
7+
fn rand() -> i32 { unimplemented!() }
8+
9+
#[thrust::requires(true)]
10+
#[thrust::ensures(exists x:int. result == 2 * x)]
11+
fn f() -> i32 {
12+
let x = rand();
13+
x + x
14+
}
15+
16+
fn main() {}

0 commit comments

Comments
 (0)