File: test_quantizer.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 (16 lines) | stat: -rw-r--r-- 401 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <gtest/gtest.h>
#include "quantizer.h"

using namespace chromaprint;

TEST(Quantizer, Quantize) {
	Quantizer q(0.0, 0.1, 0.3);
	EXPECT_EQ(0, q.Quantize(-0.1));
	EXPECT_EQ(1, q.Quantize(0.0));
	EXPECT_EQ(1, q.Quantize(0.03));
	EXPECT_EQ(2, q.Quantize(0.1));
	EXPECT_EQ(2, q.Quantize(0.13));
	EXPECT_EQ(3, q.Quantize(0.3));
	EXPECT_EQ(3, q.Quantize(0.33));
	EXPECT_EQ(3, q.Quantize(1000.0));
}