summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/expressions/ExpressionTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/expressions/ExpressionTest.java')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/expressions/ExpressionTest.java44
1 files changed, 42 insertions, 2 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/expressions/ExpressionTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/expressions/ExpressionTest.java
index f87fd31172..1070a25f55 100644
--- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/expressions/ExpressionTest.java
+++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/expressions/ExpressionTest.java
@@ -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;
@@ -139,6 +137,13 @@ public class ExpressionTest {
}
@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};
Object[] actual = neq(literal(0), literal(1)).toArray();
@@ -153,6 +158,13 @@ public class ExpressionTest {
}
@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};
Object[] actual = gt(literal(0), literal(1)).toArray();
@@ -167,6 +179,13 @@ public class ExpressionTest {
}
@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};
Object[] actual = lt(literal(1), literal(0)).toArray();
@@ -181,6 +200,13 @@ public class ExpressionTest {
}
@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};
Object[] actual = gte(literal(1), literal(1)).toArray();
@@ -195,6 +221,13 @@ public class ExpressionTest {
}
@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};
Object[] actual = lte(literal(1), literal(1)).toArray();
@@ -202,6 +235,13 @@ public class ExpressionTest {
}
@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};
Object[] actual = lte(literal(1), 1).toArray();