public void GetChars_method_should_return_positive_values( [Values("Hello", "world", "my", "dear", "friend!")] string test) { //arrange var complex = new ComplexSample(); //act var result = complex.GetChars(test); //assert Assert.IsTrue(result.Sum() >= 0 || result.Sum() < 0); }
static void Main(string[] args) { // Define the default EduHub Directory if non-standard environment (ie. testing) // EduHubContext.DefaultEduHubDirectory = @"E:\eduHub"; // Simple Sample SimpleSample.Run(); // Navigation Sample NavigationSample.Run(); // Complex Sample (May only run successfully when AKC and AR datasets are manually added to Service C) ComplexSample.Run(); // Write-Back Sample // WriteBackSample.Run(); }
public override void Receive(ComplexSample newSample) { //Add the new sample to the buffer mBuffer[mBufferPointer] = newSample; //Increment & Adjust the buffer pointer for circular wrap around mBufferPointer++; if (mBufferPointer >= mBufferSize) { mBufferPointer = 0; } //Convolution - multiply filter coefficients by the circular buffer //samples to calculate a new filtered value double leftAccumulator = 0; double rightAccumulator = 0; //Start with the center tap value leftAccumulator += mCoefficients[mCenterCoefficient] * mBuffer[mIndexMap[mBufferPointer][mCenterCoefficientMapIndex]].Left; rightAccumulator += mCoefficients[mCenterCoefficient] * mBuffer[mIndexMap[mBufferPointer][mCenterCoefficientMapIndex]].Right; //For the remaining coefficients, add the symmetric samples, oldest and newest //first, then multiply by the single coefficient for (int x = 0; x < mCenterCoefficient; x++) { leftAccumulator += mCoefficients[x] * (mBuffer[mIndexMap[mBufferPointer][x]].Left + mBuffer[mIndexMap[mBufferPointer][x + mCenterCoefficient]].Left); rightAccumulator += mCoefficients[x] * (mBuffer[mIndexMap[mBufferPointer][x]].Right + mBuffer[mIndexMap[mBufferPointer][x + mCenterCoefficient]].Right); } //We're almost finished ... apply gain, cast the doubles to floats and //send it on it's merry way Send(new ComplexSample((float)(leftAccumulator * mGain), (float)(rightAccumulator * mGain))); }