forked from davedelong/DDMathParser
/
ParserTests.m
29 lines (22 loc) · 953 Bytes
/
ParserTests.m
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
//
// ParserTests.m
// DDMathParser
//
// Created by Dave DeLong on 11/11/10.
// Copyright 2010 Home. All rights reserved.
//
#import "ParserTests.h"
#import "DDExpression.h"
@implementation ParserTests
- (void) testSimpleParsing {
NSLog(@"%@", [DDExpression expressionFromString:@"1" error:nil]);
NSLog(@"%@", [DDExpression expressionFromString:@"1 + 2" error:nil]);
NSLog(@"%@", [DDExpression expressionFromString:@"1 + 2 + 3" error:nil]);
NSLog(@"%@", [DDExpression expressionFromString:@"1 + 2 - 3 + 4" error:nil]);
NSLog(@"%@", [DDExpression expressionFromString:@"-1 + 2 - 3 + 4" error:nil]);
NSLog(@"%@", [DDExpression expressionFromString:@"SUBTRACT(ADD(NEGATE(1),2),ADD(3,4))" error:nil]);
NSLog(@"%@", [DDExpression expressionFromString:@"1 + $a" error:nil]);
NSLog(@"%@", [DDExpression expressionFromString:@"2 ** 3 ** 2" error:nil]);
NSLog(@"%@", [DDExpression expressionFromString:@"ADD(1,2,3,$a)" error:nil]);
}
@end