Skip to content
Snippets Groups Projects
Verified Commit 08af0783 authored by Ogilvie, D.H. (Duncan)'s avatar Ogilvie, D.H. (Duncan)
Browse files

small improvements

parent 48f4b2be
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,7 @@ lExprToZ3AstAlgebra = (flConst, flVar, flNot, flBinop, flComp, flQuant, flArray,
a <- a'
mkSelect v a
flNil = do intSort <- mkBvSort 32
zero <- mkBitvector 32 0
zero <- mkBitvector 32 0 -- (isNull, data, length) TODO
mkConstArray intSort zero
fnConst n = mkBitvector 32 (fromIntegral n)
fnUnop o a' = do a <- a'
......
......@@ -47,8 +47,8 @@ javaExpToLExprAlgebra = (fLit, fClassLit, fThis, fThisClass, fInstanceCreation,
_
-> error $ "Unimplemented fMethodInv: " ++ show inv
fArrayAccess arrayIndex env decls = case arrayIndex of -- TODO: type checking
ArrayIndex (ExpName name) [ExpName index]
-> LArray (nameToVar name env decls) (LVar (nameToVar index env decls))
ArrayIndex (ExpName name) [expr]
-> LArray (nameToVar name env decls) (javaExpToLExpr expr env decls) -- (LVar (nameToVar index env decls))
_
-> error $ "Multidimensional arrays are not supported: " ++ show (arrayIndex)
fExpName name env decls = case name of -- TODO: type checking
......
......@@ -171,4 +171,5 @@ compareSpec method1@(_, name1) method2@(_, name2) = do
edslSrc = "javawlp_edsl/src/nl/uu/javawlp_edsl/Main.java"
testEq = compareSpec (edslSrc, "swap_spec1") (edslSrc, "swap_spec1")
testNeq = compareSpec (edslSrc, "swap_spec1") (edslSrc, "swap_spec2")
blub = compareSpec (edslSrc, "getMax_spec1") (edslSrc, "getMax_spec2")
\ No newline at end of file
blub = compareSpec (edslSrc, "getMax_spec1") (edslSrc, "getMax_spec2")
blub2 = compareSpec (edslSrc, "test1") (edslSrc, "test2")
\ No newline at end of file
......@@ -107,7 +107,21 @@ public class Main {
post(a[i] == oldaj);
}
public static void test1(int[] a)
{
pre(exists(a, i -> a[i+1] > a[i]));
post(true);
}
public static void test2(int[] a)
{
pre(false);
//pre(exists(a, i -> a[i+1] >= a[i]));
post(true);
}
public static void swap_spec2(int[] a, int i, int j) {
pre(a != null && a[0] == 0);
pre(a != null && a.length > 0 && i >= 0 && j > 0);
// introducing vars to remember old values
int oldai = a[i], oldaj = a[j];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment