Created
March 17, 2017 10:20
-
-
Save mikasjp/b06280a0d1646c701adaa4dbcd4135dd to your computer and use it in GitHub Desktop.
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
namespace InertialNavigationSystem_Test | |
{ | |
[TestFixture] | |
class FIRFilter_Test | |
{ | |
[TestCase] | |
public void FIRFilter_CreateNewObject() | |
{ | |
FIRFilter Filter = new FIRFilter(new List<double>() { 0.25, 0.25, 0.25, 0.25 }); | |
} | |
[TestCase] | |
public void FIRFilter_FilterFewSamples() | |
{ | |
FIRFilter Filter = new FIRFilter(new List<double>() { 0.25, 0.25, 0.25, 0.25 }); | |
Filter.AddSample(new Sample(0, 0)); | |
Filter.AddSample(new Sample(1, 1)); | |
Filter.AddSample(new Sample(2, 2)); | |
Filter.AddSample(new Sample(3, 4)); | |
Sample filteredSample = Filter.AddSample(new Sample(4, 8)); | |
Assert.AreEqual((1*0.25 + 2*0.25 + 4*0.25 + 8*0.25), filteredSample.Value); | |
filteredSample = Filter.AddSample(new Sample(5, 2)); | |
Assert.AreEqual((2 * 0.25 + 4 * 0.25 + 8 * 0.25 + 2*0.25), filteredSample.Value); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment