summaryrefslogtreecommitdiff
path: root/extractor/features/is_source_singleton_test.cc
blob: 8c71e5939fa75db3e68ce475145db436732b0a7a (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
#include <gtest/gtest.h>

#include <memory>
#include <string>

#include "is_source_singleton.h"

using namespace std;
using namespace ::testing;

namespace {

class IsSourceSingletonTest : public Test {
 protected:
  virtual void SetUp() {
    feature = make_shared<IsSourceSingleton>();
  }

  shared_ptr<IsSourceSingleton> feature;
};

TEST_F(IsSourceSingletonTest, TestGetName) {
  EXPECT_EQ("IsSingletonF", feature->GetName());
}

TEST_F(IsSourceSingletonTest, TestScore) {
  Phrase phrase;
  FeatureContext context(phrase, phrase, 0.5, 3, 31);
  EXPECT_EQ(0, feature->Score(context));

  context = FeatureContext(phrase, phrase, 1, 3, 25);
  EXPECT_EQ(1, feature->Score(context));
}

}  // namespace