Skip to content

Instantly share code, notes, and snippets.

@mikasjp
Created March 17, 2017 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikasjp/b06280a0d1646c701adaa4dbcd4135dd to your computer and use it in GitHub Desktop.
Save mikasjp/b06280a0d1646c701adaa4dbcd4135dd to your computer and use it in GitHub Desktop.
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