You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Commit: 00bf945 with cherry-picked fc58e4af529a0e402d6c37d19f07e551da7ece39 (from @MchKosticyn fork)
Tested code:
namespace NetFeaturesDemo;
public enum EventType
{
Save,
Change
}
public record Event(int UserId, EventType Type, string Delta);
public interface ISaver<in T>
{
bool Save(IEnumerable<T> deltas);
}
public static class AutoSaveService
{
public static bool AutoSave(int userId, int autoSaveThreshold, ISaver<string> saver)
{
var events = new List<Event>
{
new Event(1, EventType.Change, "gcctaca"),
new Event(1, EventType.Change, "ctccagg"),
new Event(1, EventType.Save, ""),
new Event(1, EventType.Change, "gatagtc"),
new Event(2, EventType.Change, "agcggaa"),
};
var notSavedChanges =
from e in events where e.UserId == userId select e;
notSavedChanges = notSavedChanges.TakeWhile(e => e.Type == EventType.Change);
if (notSavedChanges.Count() > autoSaveThreshold)
{
return saver.Save(from e in notSavedChanges select e.Delta);
}
return false;
}
}
[Error] [15/12/2022 12:50:36] Tests renderer: deserialization of test failed: System.IO.InvalidDataException: Input test is incorrect
---> System.Collections.Generic.KeyNotFoundException: An index satisfying the predicate was not found in the collection.
at Microsoft.FSharp.Collections.SeqModule.Find[T](FSharpFunc`2 predicate, IEnumerable`1 source) in D:\a\_work\1\s\src\FSharp.Core\seq.fs:line 811
at VSharp.methodRepr.Decode() in D:\VSharp\VSharp.Utils\Mocking.fs:line 21
at [email protected](methodRepr m, Object[] c) in D:\VSharp\VSharp.Utils\Mocking.fs:line 153
at Microsoft.FSharp.Collections.ArrayModule.Map2[T1,T2,TResult](FSharpFunc`2 mapping, T1[] array1, T2[] array2) in D:\a\_work\1\s\src\FSharp.Core\array.fs:line 393
at VSharp.Mocking.Type..ctor(typeMockRepr repr) in D:\VSharp\VSharp.Utils\Mocking.fs:line 153
at VSharp.UnitTest..ctor(MethodBase m, testInfo info, Boolean createCompactRepr) in D:\VSharp\VSharp.Utils\UnitTest.fs:line 57
at VSharp.UnitTest.DeserializeFromTestInfo(testInfo ti, Boolean createCompactRepr) in D:\VSharp\VSharp.Utils\UnitTest.fs:line 215
--- End of inner exception stack trace ---
at VSharp.UnitTest.DeserializeFromTestInfo(testInfo ti, Boolean createCompactRepr) in D:\VSharp\VSharp.Utils\UnitTest.fs:line 218
at VSharp.TestRenderer.Renderer.DeserializeTest(FileInfo test) in D:\VSharp\VSharp.TestRenderer\RendererTool.cs:line 539
at VSharp.TestRenderer.Renderer.DeserializeTests(IEnumerable`1 tests) in D:\VSharp\VSharp.TestRenderer\RendererTool.cs:line 549
[Error] [15/12/2022 12:50:37] Tests renderer: rendering test failed: System.NotImplementedException: rendering constructors not supported yet
at VSharp.TestRenderer.TestsRenderer.RenderTestsForType(IEnumerable`1 tests, ProgramRenderer testsProgram, ProgramRenderer mocksProgram, Type declaringType, Boolean wrapErrors) in D
:\VSharp\VSharp.TestRenderer\TestsRenderer.cs:line 588
NB: generation for this code works fine
public static class Linq
{
private enum EventType
{
Save,
Change
}
private record Event(int UserId, EventType Type, string Delta);
public interface ISaver<in T>
{
bool Save(IEnumerable<T> deltas);
}
public static class AutoSaveService
{
public static bool AutoSave(int userId, int autoSaveThreshold, ISaver<string> saver)
{
var events = new List<Event>
{
new Event(1, EventType.Change, "gcctaca"),
new Event(1, EventType.Change, "ctccagg"),
new Event(1, EventType.Save, ""),
new Event(1, EventType.Change, "gatagtc"),
new Event(2, EventType.Change, "agcggaa"),
};
var notSavedChanges =
from e in events where e.UserId == userId select e;
notSavedChanges = notSavedChanges.TakeWhile(e => e.Type == EventType.Change);
if (notSavedChanges.Count() > autoSaveThreshold)
{
return saver.Save(from e in notSavedChanges select e.Delta);
}
return false;
}
}
}
The text was updated successfully, but these errors were encountered:
Commit: 00bf945 with cherry-picked fc58e4af529a0e402d6c37d19f07e551da7ece39 (from @MchKosticyn fork)
Tested code:
Runner config:
--all-public-methods <dll path> --render-tests --single-file --output <output path>
Stack trace:
NB: generation for this code works fine
The text was updated successfully, but these errors were encountered: