-
Notifications
You must be signed in to change notification settings - Fork 3
/
XNAbstractFunctionTest.m
34 lines (24 loc) · 1.05 KB
/
XNAbstractFunctionTest.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
30
31
32
33
34
//
// XNAbstractFunctionTest.m
// XNMaths
//
// Created by Нат Гаджибалаев on 23.12.09.
// Copyright 2009 Нат Гаджибалаев. All rights reserved.
//
#import "XNAbstractFunctionTest.h"
@implementation XNAbstractFunctionTest
- (void) testSimpleOperations
{
XNAbstractFunction *func = [[XNAbstractFunction alloc] initWithExpression: @"x + y + z + t"
andArguments: [NSArray arrayWithObjects: @"x", @"y", @"z", @"z", nil]];
func.arguments = [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithFloat: 1.], @"x",
[NSNumber numberWithFloat: 8.], @"y",
[NSNumber numberWithFloat: -2.], @"z",
[NSNumber numberWithFloat: 3.], @"t", nil];
STAssertEquals( [func valueWithCurrentArguments], 10.0f, @"Incorrect value");
[func setValue: 10. forArgument: @"y"];
STAssertEquals( [func valueWithCurrentArguments], 12.0f, @"Incorrect value");
STAssertThrows( [func setValue: 123 forArgument: @"smth"], @"Should raise an error when setting unknown argument." );
[func release];
}
@end