Skip to content

Commit b09958a

Browse files
committed
Test parsing existentials
1 parent 298b8e8 commit b09958a

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,31 @@ 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+
cat <<EOF > thrust-pcsat-wrapper
35+
#!/bin/bash
36+
37+
smt2=$(mktemp -p . --suffix .smt2)
38+
trap "rm -f $smt2" EXIT
39+
cp "$1" "$smt2"
40+
out=$(
41+
docker run --rm -v $PWD:/mnt -w /root/coar "$COAR_IMAGE"
42+
main.exe -c ./config/solver/pcsat_tbq_ar.json -p pcsp "/mnt/$smt2"
43+
)
44+
exit_code=$?
45+
echo "${out%,*}"
46+
exit "$exit_code"
47+
EOF
48+
chmod +x thrust-pcsat-wrapper
49+
50+
mkdir -p ~/.local/bin
51+
mv thrust-pcsat-wrapper ~/.local/bin/thrust-pcsat-wrapper
3052
- run: rustup show
3153
- uses: Swatinem/rust-cache@v2
3254
- 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)