Skip to content

Commit

Permalink
Add the (modernized) test case from #220, last lingering part of that…
Browse files Browse the repository at this point in the history
… issue.
  • Loading branch information
sauclovian-g committed Jan 24, 2025
1 parent ec8844e commit 48ee3ce
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
18 changes: 18 additions & 0 deletions intTests/test0220/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The current checked-in test.bc was generated by:
# Apple clang version 15.0.0 (clang-1500.1.0.2.5)
# Target: arm64-apple-darwin22.6.0
# Thread model: posix
# InstalledDir: /Library/Developer/CommandLineTools/usr/bin
# but neither the target nor the clang/llvm version is expected to be
# significant.
CC = clang
CFLAGS = -g -O0

all: test.bc

test.bc: test.c
$(CC) $(CFLAGS) -c -emit-llvm $< -o $@

.PHONY: clean
clean:
rm -f test.bc
Binary file added intTests/test0220/test.bc
Binary file not shown.
5 changes: 5 additions & 0 deletions intTests/test0220/test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
unsigned char y;

void f(void) {
y = 6;
}
15 changes: 15 additions & 0 deletions intTests/test0220/test.saw
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Test an inexact postcondition.

mod <- llvm_load_module "test.bc";

let spec = do {
llvm_alloc_global "y";
y <- llvm_fresh_var "y" (llvm_int 8);
llvm_points_to (llvm_global "y") (llvm_term y);
llvm_execute_func [];
y_new <- llvm_fresh_var "y_new" (llvm_int 8);
llvm_points_to (llvm_global "y") (llvm_term y_new);
llvm_postcond {{ y_new > 0 }};
};

llvm_verify mod "f" [] false spec abc;
3 changes: 3 additions & 0 deletions intTests/test0220/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set -e

$SAW test.saw

0 comments on commit 48ee3ce

Please sign in to comment.