blob: 7d22610410496daef428ff912b333f34abd6fb90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include <gtest/gtest.h>
#include <cmath>
#include <memory>
#include <string>
#include "sample_source_count.h"
using namespace std;
using namespace ::testing;
namespace {
class SampleSourceCountTest : public Test {
protected:
virtual void SetUp() {
feature = make_shared<SampleSourceCount>();
}
shared_ptr<SampleSourceCount> feature;
};
TEST_F(SampleSourceCountTest, TestGetName) {
EXPECT_EQ("SampleCountF", feature->GetName());
}
TEST_F(SampleSourceCountTest, TestScore) {
Phrase phrase;
FeatureContext context(phrase, phrase, 0, 3, 1);
EXPECT_EQ(log10(2), feature->Score(context));
context = FeatureContext(phrase, phrase, 3.2, 3, 9);
EXPECT_EQ(1.0, feature->Score(context));
}
} // namespace
|