Skip to content

Commit

Permalink
[test] added test
Browse files Browse the repository at this point in the history
- style fixed
  • Loading branch information
MchKosticyn committed Dec 4, 2023
1 parent bebc3bd commit c20533d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions VSharp.SILI.Core/Memory.fs
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ module internal Memory =
| ConcreteHeapAddress concreteAddress, None when cm.Contains concreteAddress ->
let data = cm.GetAllArrayData concreteAddress
readSymbolicIndexFromConcreteArray state concreteAddress data indices arrayType
// TODO: remember all concrete data from 'ConcreteMemory' and add it to symbolic constant [Test: ConcreteDictionaryTest1]
| _ -> readArrayIndexSymbolic state address indices arrayType

// ------------------------------- Array writing -------------------------------
Expand Down Expand Up @@ -904,6 +905,7 @@ module internal Memory =
match address.term with
| ConcreteHeapAddress address when cm.Contains address ->
cm.ReadClassField address field |> objToTerm state field.typ
// TODO: remember all concrete field values from 'ConcreteMemory' and add it to symbolic constant [Test: ConcreteDictionaryTest1]
| _ -> readClassFieldSymbolic state address field

let readStaticField state typ (field : fieldId) =
Expand Down
11 changes: 10 additions & 1 deletion VSharp.Test/Tests/Lists.cs
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ public static int ConcreteDictionaryTest(int v)
return 0;
}

[Ignore("needs fix")]
[Ignore("fix composition with concrete memory")]
public static int ConcreteDictionaryTest1(int a, int b)
{
var d = new Dictionary<int, List<int>>();
Expand All @@ -848,6 +848,15 @@ public static int ConcreteDictionaryTest1(int a, int b)
return 2;
}

[TestSvm(100)]
public static int ListContains(int a, int b)
{
var l = new List<int> {2, 3, b, 5};
if (l.Contains(a))
return 1;
return 0;
}

[Ignore("Support rendering recursive arrays")]
public static object[] ConcreteRecursiveArray()
{
Expand Down
1 change: 0 additions & 1 deletion VSharp.Utils/MemoryGraph.fs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ with
t.MethodMocks |> Seq.map (fun m -> m.ReturnValues |> Array.map encode) |> Array.ofSeq
outImplementations =
t.MethodMocks |> Seq.map (fun m -> m.OutValues |> Array.map (Array.map encode)) |> Seq.toArray

}

member x.Decode() =
Expand Down

0 comments on commit c20533d

Please sign in to comment.