summaryrefslogtreecommitdiff
path: root/extractor/features/is_source_target_singleton_test.cc
blob: 929635b0f9de643044efa27fa3f324a3a2aca1f3 (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
37
38
39
#include <gtest/gtest.h>

#include <memory>
#include <string>

#include "is_source_target_singleton.h"

using namespace std;
using namespace ::testing;

namespace extractor {
namespace features {
namespace {

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

  shared_ptr<IsSourceTargetSingleton> feature;
};

TEST_F(IsSourceTargetSingletonTest, TestGetName) {
  EXPECT_EQ("IsSingletonFE", feature->GetName());
}

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

  context = FeatureContext(phrase, phrase, 2.3, 1, 28);
  EXPECT_EQ(1, feature->Score(context));
}

} // namespace
} // namespace features
} // namespace extractor