Line | Branch | Decision | Exec | Source |
---|---|---|---|---|
1 | #include "pch.h" | |||
2 | ||||
3 | #include "software_knock.h" | |||
4 | #include "fft/fft.hpp" | |||
5 | ||||
6 | #define KNOCK_SAMPLE_RATE 16 | |||
7 | ||||
8 | 4 | TEST(knock, fft) { | ||
9 | 1 | SpectrogramData data; | ||
10 | 1 | adcsample_t sampleBuffer[FFT_SIZE]; | ||
11 | ||||
12 | 1 | float ratio = 1; | ||
13 | 1 | float sensetivity = 1; | ||
14 | ||||
15 |
2/2✓ Branch 0 taken 1024 times.
✓ Branch 1 taken 1 time.
|
2/2✓ Decision 'true' taken 1024 times.
✓ Decision 'false' taken 1 time.
|
1025 | for (int i = 0;i<FFT_SIZE;i++) { |
16 | 1024 | data.window[i] = 35; | ||
17 | 1024 | sampleBuffer[i] = i; | ||
18 | } | |||
19 | ||||
20 |
1/1✓ Branch 1 taken 1 time.
|
1 | fft::fft_adc_sample(data.window, ratio, sensetivity, sampleBuffer, data.fftBuffer, FFT_SIZE); | |
21 | ||||
22 | /* | |||
23 | ASSERT_NEAR(data.fftBuffer[2].imag(), 730090, 1); | |||
24 | ASSERT_NEAR(data.fftBuffer[3].imag(), 486696, 1); | |||
25 | ASSERT_NEAR(data.fftBuffer[4].imag(), 364990, 1); | |||
26 | ||||
27 | ASSERT_NEAR(data.fftBuffer[2].real(), -8960, 1); | |||
28 | ASSERT_NEAR(data.fftBuffer[3].real(), -8960, 1); | |||
29 | ASSERT_NEAR(data.fftBuffer[4].real(), -8960, 1); | |||
30 | */ | |||
31 | 1 | } | ||
32 |