File: test_filter.cpp

package info (click to toggle)
chromaprint 1.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,336 kB
  • sloc: cpp: 58,922; python: 4,402; ansic: 3,461; sh: 440; makefile: 366
file content (23 lines) | stat: -rw-r--r-- 565 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (C) 2010-2016  Lukas Lalinsky
// Distributed under the MIT license, see the LICENSE file for details.

#include <gtest/gtest.h>
#include "filter.h"
#include "utils/rolling_integral_image.h"
#include "test_utils.h"

namespace chromaprint {

TEST(Filter, Filter0) {
	double data[] = {
		0.0, 1.0,
		2.0, 3.0,
	};
	RollingIntegralImage integral_image(2, data, data + NELEMS(data));

	Filter flt1(0, 0, 1, 1);	
	ASSERT_FLOAT_EQ(0.0, flt1.Apply(integral_image, 0));
	ASSERT_FLOAT_EQ(1.0986123, flt1.Apply(integral_image, 1));
}

}; // namespace chromaprint