Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[ios] Added a couple more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jmkiley committed Sep 25, 2019
1 parent c48e450 commit 09708ef
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions platform/darwin/test/MGLExpressionTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,20 @@ - (void)testArithmeticExpressionObject {
// NSExpression lacks a shorthand operator for modulus.
XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression);
}
{
NSExpression *expression = [NSExpression expressionForFunction:@"max:" arguments:arguments];
NSArray *jsonExpression = @[@"max", @1, @1];
XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression);
// Getting exception
// XCTAssertEqualObjects([expression expressionValueWithObject:nil context:nil], @1);
}
{
NSExpression *expression = [NSExpression expressionForFunction:@"min:" arguments:arguments];
NSArray *jsonExpression = @[@"min", @1, @1];
XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression);
// -[__NSCFNumber count]: unrecognized selector sent to instance 0xd2b9e475c245aa2a
// XCTAssertEqualObjects([expression expressionValueWithObject:nil context:nil], @1);
}
{
NSExpression *expression = [NSExpression expressionForFunction:@"ceiling:" arguments:@[MGLConstantExpression(@1.5)]];
NSArray *jsonExpression = @[@"ceil", @1.5];
Expand Down Expand Up @@ -634,6 +648,16 @@ - (void)testStringFormattingExpressionObject {
XCTAssertEqualObjects([aftermarketExpression expressionValueWithObject:nil context:nil], @"OldMacDonald");
XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], aftermarketExpression);
}
{
NSExpression *expression = [NSExpression expressionForFunction:@"mgl_join:" arguments:@[@"Old", @"MacDonald"]];
NSExpression *aftermarketExpression = [NSExpression expressionWithFormat:@"mgl_join({'Old', 'MacDonald'})"];
NSArray *jsonExpression = @[@"concat", @"Old", @"MacDonald"];
XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression);

XCTAssertEqualObjects(aftermarketExpression.mgl_jsonExpressionObject, expression.mgl_jsonExpressionObject);
// Getting exception
// XCTAssertEqualObjects([expression expressionValueWithObject:nil context:nil], @"OldMacDonald");
}
{
NSExpression *expression = [NSExpression expressionForFunction:@"uppercase:" arguments:arguments];
NSArray *jsonExpression = @[@"upcase", @"MacDonald"];
Expand Down

0 comments on commit 09708ef

Please sign in to comment.