added nested lists test

appveyor coverage upload fix
This commit is contained in:
Christian Köllner 2020-03-02 18:03:46 +01:00
parent e1abf7b61c
commit 15a11391e0
2 changed files with 40 additions and 1 deletions

View File

@ -1,6 +1,7 @@
using Capnproto_test.Capnp.Test; using Capnproto_test.Capnp.Test;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace Capnp.Net.Runtime.Tests namespace Capnp.Net.Runtime.Tests
@ -392,5 +393,43 @@ namespace Capnp.Net.Runtime.Tests
Assert.ThrowsException<NotSupportedException>(() => ld.CastList()); Assert.ThrowsException<NotSupportedException>(() => ld.CastList());
Assert.ThrowsException<NotSupportedException>(() => ld.CastCapList<ITestInterface>()); Assert.ThrowsException<NotSupportedException>(() => ld.CastCapList<ITestInterface>());
} }
[TestMethod]
public void NestedListsND()
{
var expected = new int[][][] {
new int[][]
{
new int[] { 1, 2, 3 },
new int[] { 4, 5 },
new int[] { 6 }
},
new int[][]
{
new int[] { 1, 2, 3 },
new int[0]
},
new int[0][]
};
var b = MessageBuilder.Create();
var dss = b.CreateObject<DynamicSerializerState>();
dss.SetObject(expected);
DeserializerState d = dss;
var ld = d.RequireList();
var result = (IReadOnlyList<object>)ld.CastND<int>(3);
Assert.AreEqual(3, result.Count);
for (int i = 0; i < result.Count; i++)
{
var inner = (IReadOnlyList<object>)result[i];
Assert.AreEqual(expected[i].Length, inner.Count);
for (int j = 0; j < expected[i].Length; i++)
{
var inner2 = (IReadOnlyList<int>)inner[j];
CollectionAssert.AreEqual(expected[i][j], inner2.ToArray());
}
}
}
} }
} }

View File

@ -90,7 +90,7 @@ test_script:
vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests.Core21\bin\Debug\netcoreapp2.1\Capnp.Net.Runtime.Tests.Core21.dll vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests.Core21\bin\Debug\netcoreapp2.1\Capnp.Net.Runtime.Tests.Core21.dll
vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests.Core21\bin\Release\netcoreapp2.1\Capnp.Net.Runtime.Tests.Core21.dll vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests.Core21\bin\Release\netcoreapp2.1\Capnp.Net.Runtime.Tests.Core21.dll
powershell -File .\scripts\measure-coverage.ps1 powershell -File .\scripts\measure-coverage.ps1
csmacnz.Coveralls --multiple -i "opencover=coverage\cov-Capnp.Net.Runtime-dnc21.xml;opencover=coverage\cov-Capnp.Net.Runtime-net471.xml;opencover=coverage\cov-CapnpC.CSharp.Generator.xml" --repoToken $env:COVERALLS_REPO_TOKEN --commitId $env:APPVEYOR_REPO_COMMIT --commitBranch $env:APPVEYOR_REPO_BRANCH --commitAuthor $env:APPVEYOR_REPO_COMMIT_AUTHOR --commitEmail $env:APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL --commitMessage $env:APPVEYOR_REPO_COMMIT_MESSAGE --jobId $env:APPVEYOR_JOB_ID csmacnz.Coveralls --multiple -i "opencover=coverage\cov-Capnp.Net.Runtime-dnc21.xml;opencover=coverage\cov-Capnp.Net.Runtime-net471.xml;opencover=coverage\cov-CapnpC.CSharp.Generator.xml" --repoToken %COVERALLS_REPO_TOKEN%
on_finish : on_finish :
# any cleanup in here # any cleanup in here
deploy: deploy: