aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/aggregator/attr_test.cpp
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-03-23 10:30:23 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2017-03-27 16:21:01 +0200
commit3656023785d17d513b67f4cbe8686a40141e06d8 (patch)
treed3e26110f82326573c0378d74f8d1dc189b32973 /searchlib/src/tests/aggregator/attr_test.cpp
parent0cd6a2c04f90ffbdba4d585f1d71a5dd2b4e8311 (diff)
Remove ExpressionNode::CP from interfaces.
Diffstat (limited to 'searchlib/src/tests/aggregator/attr_test.cpp')
-rw-r--r--searchlib/src/tests/aggregator/attr_test.cpp39
1 files changed, 9 insertions, 30 deletions
diff --git a/searchlib/src/tests/aggregator/attr_test.cpp b/searchlib/src/tests/aggregator/attr_test.cpp
index 49ec52274f9..874e79495c8 100644
--- a/searchlib/src/tests/aggregator/attr_test.cpp
+++ b/searchlib/src/tests/aggregator/attr_test.cpp
@@ -114,13 +114,11 @@ struct StringAttrFixture {
}
};
+#define MU std::make_unique
TEST_F("testArrayAt", AttributeFixture()) {
for (int i = 0; i < 11; i++) {
- ExpressionNode::CP cn(new ConstantNode(new Int64ResultNode(i)));
- ExpressionNode::CP ln(new ArrayAtLookup(*f1.guard, cn));
-
- ExpressionTree et(ln);
+ ExpressionTree et(MU<ArrayAtLookup>(*f1.guard, MU<ConstantNode>(MU<Int64ResultNode>(i))));
ExpressionTree::Configure treeConf;
et.select(treeConf, treeConf);
EXPECT_TRUE(et.getResult().getClass().inherits(FloatResultNode::classId));
@@ -134,15 +132,11 @@ TEST_F("testArrayAt", AttributeFixture()) {
TEST_F("testArrayAtInt", IntAttrFixture()) {
for (int i = 0; i < 3; i++) {
- ExpressionNode::CP othercn(new ConstantNode(new Int64ResultNode(4567)));
- ArrayAtLookup *x = new ArrayAtLookup(*f1.guard, othercn);
- ExpressionNode::CP cn(new ConstantNode(new Int64ResultNode(i)));
- ArrayAtLookup *y = new ArrayAtLookup(*f1.guard, cn);
+ auto x = MU<ArrayAtLookup>(*f1.guard, MU<ConstantNode>(MU<Int64ResultNode>(4567)));
+ auto y = MU<ArrayAtLookup>(*f1.guard, MU<ConstantNode>(MU<Int64ResultNode>(i)));
*x = *y;
- delete y;
- ExpressionNode::CP ln(x);
- ExpressionTree et(ln);
+ ExpressionTree et(std::move(x));
ExpressionTree::Configure treeConf;
et.select(treeConf, treeConf);
EXPECT_TRUE(et.getResult().getClass().inherits(IntegerResultNode::classId));
@@ -156,10 +150,7 @@ TEST_F("testArrayAtInt", IntAttrFixture()) {
TEST_F("testArrayAtString", StringAttrFixture()) {
- ExpressionNode::CP cn(new ConstantNode(new Int64ResultNode(1)));
- ExpressionNode::CP ln(new ArrayAtLookup(*f1.guard, cn));
-
- ExpressionTree et(ln);
+ ExpressionTree et(MU<ArrayAtLookup>(*f1.guard, MU<ConstantNode>(MU<Int64ResultNode>(1))));
ExpressionTree::Configure treeConf;
et.select(treeConf, treeConf);
EXPECT_TRUE(et.getResult().getClass().inherits(StringResultNode::classId));
@@ -177,15 +168,11 @@ TEST_F("testArrayAtString", StringAttrFixture()) {
struct ArrayAtExpressionFixture :
public AttributeFixture
{
- ExpressionNode::CP cn;
- ExpressionNode::CP ln;
ExpressionTree et;
ArrayAtExpressionFixture(int i) :
AttributeFixture(),
- cn(new ConstantNode(new Int64ResultNode(i))),
- ln(new ArrayAtLookup(*guard, cn)),
- et(ln)
+ et(MU<ArrayAtLookup>(*guard, MU<ConstantNode>(MU<Int64ResultNode>(i))))
{
ExpressionTree::Configure treeConf;
et.select(treeConf, treeConf);
@@ -212,11 +199,7 @@ TEST_F("testArrayAtAboveRange", ArrayAtExpressionFixture(17)) {
}
TEST_F("testInterpolatedLookup", AttributeFixture()) {
-
- ExpressionNode::CP c1(new ConstantNode(new FloatResultNode(f1.doc0attr[2])));
- ExpressionNode::CP l1(new InterpolatedLookup(*f1.guard, c1));
-
- ExpressionTree et(l1);
+ ExpressionTree et(MU<InterpolatedLookup>(*f1.guard, MU<ConstantNode>(MU<FloatResultNode>(f1.doc0attr[2]))));
ExpressionTree::Configure treeConf;
et.select(treeConf, treeConf);
@@ -230,11 +213,7 @@ TEST_F("testInterpolatedLookup", AttributeFixture()) {
}
TEST_F("testWithRelevance", AttributeFixture()) {
-
- ExpressionNode::CP r1(new RelevanceNode());
- ExpressionNode::CP l1(new InterpolatedLookup(*f1.guard, r1));
-
- ExpressionTree et(l1);
+ ExpressionTree et(MU<InterpolatedLookup>(*f1.guard, MU<RelevanceNode>()));
ExpressionTree::Configure treeConf;
et.select(treeConf, treeConf);