Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ScottPlot.Tools.Pad() to pad arrays with data on each side #255
- Loading branch information
Showing
3 changed files
with
65 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
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
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,37 @@ | ||
using NUnit.Framework; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace ScottPlotTests.Tools | ||
{ | ||
class Pad | ||
{ | ||
[Test] | ||
public void Test_Pad_NoArguments() | ||
{ | ||
double[] values = { 1, 2, 3 }; | ||
double[] result = ScottPlot.Tools.Pad(values); | ||
|
||
Assert.AreEqual(new double[] { 0, 1, 2, 3, 0 }, result); | ||
} | ||
|
||
[Test] | ||
public void Test_Pad_MultipleDefined() | ||
{ | ||
double[] values = { 1, 2, 3 }; | ||
double[] result = ScottPlot.Tools.Pad(values, 3, -1, -2); | ||
|
||
Assert.AreEqual(new double[] { -1, -1, -1, 1, 2, 3, -2, -2, -2 }, result); | ||
} | ||
|
||
[Test] | ||
public void Test_Pad_CloneEdges() | ||
{ | ||
double[] values = { 1, 2, 3 }; | ||
double[] result = ScottPlot.Tools.Pad(values, 3, cloneEdges: true); | ||
|
||
Assert.AreEqual(new double[] { 1, 1, 1, 1, 2, 3, 3, 3, 3 }, result); | ||
} | ||
} | ||
} |