-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If there are no enumerators, it enters an infinite loop. (#257)
* If there are no enumerators, it enters an infinite loop. * Add test
- Loading branch information
1 parent
83a06ee
commit 204bb50
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
tests/SIL.Machine.Tests/Utils/EnumberableExtensionTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using NUnit.Framework; | ||
|
||
namespace SIL.Machine.Utils; | ||
|
||
[TestFixture] | ||
public class EnumerableExtensionTests | ||
{ | ||
[Test] | ||
public void ZipMany_None() | ||
{ | ||
var seqs = new List<IEnumerable<int>>(); | ||
IEnumerable<int> result = seqs.ZipMany(x => x.Sum()); | ||
Assert.That(result, Is.Empty); | ||
} | ||
|
||
[Test] | ||
public void ZipMany_Two() | ||
{ | ||
var seqs = new List<IEnumerable<int>> { new[] { 1, 2, 3 }, new[] { 4, 5, 6 } }; | ||
IEnumerable<int> result = seqs.ZipMany(x => x.Sum()); | ||
Assert.That(result, Is.EqualTo(new[] { 5, 7, 9 })); | ||
} | ||
} |