| 23 | namespace tensorflow { |
| 24 | |
| 25 | TEST(MfccTest, AgreesWithPythonGoldenValues) { |
| 26 | Mfcc mfcc; |
| 27 | std::vector<double> input; |
| 28 | const int kSampleCount = 513; |
| 29 | input.reserve(kSampleCount); |
| 30 | for (int i = 0; i < kSampleCount; ++i) { |
| 31 | input.push_back(i + 1); |
| 32 | } |
| 33 | |
| 34 | ASSERT_TRUE(mfcc.Initialize(input.size(), 22050 /*sample rate*/)); |
| 35 | |
| 36 | std::vector<double> output; |
| 37 | mfcc.Compute(input, &output); |
| 38 | |
| 39 | std::vector<double> expected = { |
| 40 | 29.13970072, -6.41568601, -0.61903012, -0.96778652, -0.26819878, |
| 41 | -0.40907028, -0.15614748, -0.23203119, -0.10481487, -0.1543029, |
| 42 | -0.0769791, -0.10806114, -0.06047613}; |
| 43 | |
| 44 | ASSERT_EQ(expected.size(), output.size()); |
| 45 | for (int i = 0; i < output.size(); ++i) { |
| 46 | EXPECT_NEAR(output[i], expected[i], 1e-04); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | TEST(MfccTest, AvoidsNansWithZeroInput) { |
| 51 | Mfcc mfcc; |
nothing calls this directly
no test coverage detected