From 15a11391e04ac8262079509adf1711120e7c1073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Mon, 2 Mar 2020 18:03:46 +0100 Subject: [PATCH] added nested lists test appveyor coverage upload fix --- .../DeserializationTests.cs | 39 +++++++++++++++++++ appveyor.yml | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/Capnp.Net.Runtime.Tests/DeserializationTests.cs b/Capnp.Net.Runtime.Tests/DeserializationTests.cs index 5d543bb..75536a6 100644 --- a/Capnp.Net.Runtime.Tests/DeserializationTests.cs +++ b/Capnp.Net.Runtime.Tests/DeserializationTests.cs @@ -1,6 +1,7 @@ using Capnproto_test.Capnp.Test; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using System.Collections.Generic; using System.Linq; namespace Capnp.Net.Runtime.Tests @@ -392,5 +393,43 @@ namespace Capnp.Net.Runtime.Tests Assert.ThrowsException(() => ld.CastList()); Assert.ThrowsException(() => ld.CastCapList()); } + + [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(); + dss.SetObject(expected); + DeserializerState d = dss; + var ld = d.RequireList(); + var result = (IReadOnlyList)ld.CastND(3); + Assert.AreEqual(3, result.Count); + for (int i = 0; i < result.Count; i++) + { + var inner = (IReadOnlyList)result[i]; + Assert.AreEqual(expected[i].Length, inner.Count); + + for (int j = 0; j < expected[i].Length; i++) + { + var inner2 = (IReadOnlyList)inner[j]; + CollectionAssert.AreEqual(expected[i][j], inner2.ToArray()); + } + } + } } } diff --git a/appveyor.yml b/appveyor.yml index 90cb83c..fff160f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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\Release\netcoreapp2.1\Capnp.Net.Runtime.Tests.Core21.dll 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 : # any cleanup in here deploy: