[android] - fix literal wrapping in comparission expressions

This commit is contained in:
tobrun
2018-05-29 13:10:16 +02:00
committed by Tobrun
parent 2e2d5bf03c
commit 83ebd5f6ff
2 changed files with 57 additions and 16 deletions

View File

@@ -1,9 +1,7 @@
package com.mapbox.mapboxsdk.style.expressions;
import android.graphics.Color;
import com.mapbox.mapboxsdk.style.layers.PropertyFactory;
import org.junit.Test;
import java.util.Arrays;
@@ -138,6 +136,13 @@ public class ExpressionTest {
assertTrue("expression should match", Arrays.deepEquals(expected, actual));
}
@Test
public void testEqExpression() throws Exception {
Object[] expected = new Object[] {"==",new Object[]{"get", "hello"}, 1f};
Object[] actual = eq(get("hello"), 1).toArray();
assertTrue("expression should match", Arrays.deepEquals(expected, actual));
}
@Test
public void testNeq() throws Exception {
Object[] expected = new Object[] {"!=", 0f, 1f};
@@ -152,6 +157,13 @@ public class ExpressionTest {
assertTrue("expression should match", Arrays.deepEquals(expected, actual));
}
@Test
public void testNeqExpression() throws Exception {
Object[] expected = new Object[] {"!=",new Object[]{"get", "hello"}, 1f};
Object[] actual = neq(get("hello"), 1).toArray();
assertTrue("expression should match", Arrays.deepEquals(expected, actual));
}
@Test
public void testGt() throws Exception {
Object[] expected = new Object[] {">", 0f, 1f};
@@ -166,6 +178,13 @@ public class ExpressionTest {
assertTrue("expression should match", Arrays.deepEquals(expected, actual));
}
@Test
public void testGtExpression() throws Exception {
Object[] expected = new Object[] {">", new Object[] {"get", "hello"}, 1f};
Object[] actual = gt(get("hello"), 1).toArray();
assertTrue("expression should match", Arrays.deepEquals(expected, actual));
}
@Test
public void testLt() throws Exception {
Object[] expected = new Object[] {"<", 1f, 0f};
@@ -180,6 +199,13 @@ public class ExpressionTest {
assertTrue("expression should match", Arrays.deepEquals(expected, actual));
}
@Test
public void testLtExpression() throws Exception {
Object[] expected = new Object[] {"<", new Object[] {"get", "hello"}, 1f};
Object[] actual = lt(get("hello"), 1).toArray();
assertTrue("expression should match", Arrays.deepEquals(expected, actual));
}
@Test
public void testGte() throws Exception {
Object[] expected = new Object[] {">=", 1f, 1f};
@@ -194,6 +220,13 @@ public class ExpressionTest {
assertTrue("expression should match", Arrays.deepEquals(expected, actual));
}
@Test
public void testGteExpression() throws Exception {
Object[] expected = new Object[] {">=", new Object[] {"get", "hello"}, 1f};
Object[] actual = gte(get("hello"), 1).toArray();
assertTrue("expression should match", Arrays.deepEquals(expected, actual));
}
@Test
public void testLte() throws Exception {
Object[] expected = new Object[] {"<=", 1f, 1f};
@@ -201,6 +234,13 @@ public class ExpressionTest {
assertTrue("expression should match", Arrays.deepEquals(expected, actual));
}
@Test
public void testLteExpression() throws Exception {
Object[] expected = new Object[] {"<=", new Object[] {"get", "hello"}, 1f};
Object[] actual = lte(get("hello"), 1).toArray();
assertTrue("expression should match", Arrays.deepEquals(expected, actual));
}
@Test
public void testLteLiteral() throws Exception {
Object[] expected = new Object[] {"<=", 1f, 1f};