summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@mapbox.com>2018-04-17 23:43:00 -0400
committerJulian Rex <julian.rex@mapbox.com>2018-04-24 10:51:44 -0400
commit90036c198b8075f173933e9b5aaf1b64805365c9 (patch)
tree25050e6df25764a7cdeec6846e3ad7cd70d24d88
parente318897a0a1c64d2abdd08b36920047d1c04ded8 (diff)
downloadqtlocation-mapboxgl-90036c198b8075f173933e9b5aaf1b64805365c9.tar.gz
Added unit tests (in addition to integration test)
-rw-r--r--platform/darwin/test/MGLExpressionTests.mm25
1 files changed, 25 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLExpressionTests.mm b/platform/darwin/test/MGLExpressionTests.mm
index d54e961b00..61d389f9f9 100644
--- a/platform/darwin/test/MGLExpressionTests.mm
+++ b/platform/darwin/test/MGLExpressionTests.mm
@@ -712,6 +712,31 @@ using namespace std::string_literals;
}
}
+- (void)testInterpolationExpressionObjectWithEmptyStopsDictionary {
+ {
+ NSDictionary *stops = @{};
+ NSExpression *expression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:(x, 'cubic-bezier', { 0.42, 0, 0.58, 1 }, %@)", stops];
+ @try {
+ (void)expression.mgl_jsonExpressionObject;
+ XCTFail();
+ }
+ @catch (NSException *e){
+ XCTAssert(e.name == NSInvalidArgumentException);
+ }
+ }
+ {
+ NSDictionary *stops = @{};
+ NSExpression *expression = [NSExpression expressionWithFormat:@"mgl_step:from:stops:($zoomLevel, 11, %@)", stops];
+ @try {
+ (void)expression.mgl_jsonExpressionObject;
+ XCTFail();
+ }
+ @catch (NSException *e){
+ XCTAssert(e.name == NSInvalidArgumentException);
+ }
+ }
+}
+
- (void)testMatchExpressionObject {
{
NSExpression *expression = [NSExpression expressionWithFormat:@"MGL_MATCH(2 - 1, %@, %@, %@, %@, 'default')", MGLConstantExpression(@1),