aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/prelude/semantics/test/ExpansionTestCase.java
blob: f83ad354c8954242eac3cc2e8bfba9b6ed9567b6 (plain) (blame)
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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.semantics.test;

import org.junit.jupiter.api.Test;

public class ExpansionTestCase extends RuleBaseAbstractTestCase {

    public ExpansionTestCase() {
        super("expansion.sr");
    }

    @Test
    void testOrExpansion() {
        assertSemantics("OR or1 or2 or3", "or1");
    }

    @Test
    void testEquivExpansion1() {
        assertSemantics("EQUIV equiv1 equiv2 equiv3", "equiv1");
    }

    @Test
    void testEquivExpansion2() {
        assertSemantics("EQUIV testfield:e1 testfield:e2 testfield:e3", "testfield:foo");
    }

    // No equiv: Not optimal, but not wrong either
    @Test
    void testEquivExpansion3() {
        assertSemantics("AND testfield:e1 testfield:e2 testfield:e3 testfield:e1 testfield:e2 testfield:e3",
                        "testfield:foo testfield:bar");
    }

}