|
|
@ -86,5 +86,33 @@ namespace ZeroLevel.CollectionUnitTests
|
|
|
|
Assert.True(fix.Count == 2);
|
|
|
|
Assert.True(fix.Count == 2);
|
|
|
|
Assert.True(CollectionComparsionExtensions.OrderingEquals(fix.Dump().ToArray(), new long[] { 4, 5 }));
|
|
|
|
Assert.True(CollectionComparsionExtensions.OrderingEquals(fix.Dump().ToArray(), new long[] { 4, 5 }));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
|
|
|
public void ChunkifyTest()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Arrange
|
|
|
|
|
|
|
|
var arr = new long[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
|
|
|
|
|
|
|
var empty_arr = new long[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Act
|
|
|
|
|
|
|
|
var empty_chunks = empty_arr.Chunkify(3).ToArray();
|
|
|
|
|
|
|
|
var chunks_2 = arr.Chunkify(2).ToArray();
|
|
|
|
|
|
|
|
var chunks_3 = arr.Chunkify(3).ToArray();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Assert
|
|
|
|
|
|
|
|
Assert.True(empty_chunks.Length == 0);
|
|
|
|
|
|
|
|
Assert.True(chunks_2.Length == 5);
|
|
|
|
|
|
|
|
Assert.True(chunks_3.Length == 3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assert.True(CollectionComparsionExtensions.OrderingEquals(chunks_3[0], new long[] { 1, 2, 3 }));
|
|
|
|
|
|
|
|
Assert.True(CollectionComparsionExtensions.OrderingEquals(chunks_3[1], new long[] { 4, 5, 6 }));
|
|
|
|
|
|
|
|
Assert.True(CollectionComparsionExtensions.OrderingEquals(chunks_3[2], new long[] { 7, 8, 9 }));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assert.True(CollectionComparsionExtensions.OrderingEquals(chunks_2[0], new long[] { 1, 2 }));
|
|
|
|
|
|
|
|
Assert.True(CollectionComparsionExtensions.OrderingEquals(chunks_2[1], new long[] { 3, 4 }));
|
|
|
|
|
|
|
|
Assert.True(CollectionComparsionExtensions.OrderingEquals(chunks_2[2], new long[] { 5, 6 }));
|
|
|
|
|
|
|
|
Assert.True(CollectionComparsionExtensions.OrderingEquals(chunks_2[3], new long[] { 7, 8 }));
|
|
|
|
|
|
|
|
Assert.True(CollectionComparsionExtensions.OrderingEquals(chunks_2[4], new long[] { 9 }));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|