Skip to content
This repository
Newer
Older
100644 72 lines (49 sloc) 1.671 kb
05eedb5e »
2010-01-25 initial add
1 // Copyright 2010 Todd Ditchendorf
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #import "TDSymbolTest.h"
16
17
18 @implementation TDSymbolTest
19
20 - (void)tearDown {
21 }
22
23
24 - (void)testDash {
25 s = @"-";
26 a = [PKTokenAssembly assemblyWithString:s];
27
28 p = [PKSymbol symbolWithString:s];
29
30 PKAssembly *result = [p bestMatchFor:a];
31
32 TDNotNil(result);
33 TDEqualObjects(@"[-]-^", [result description]);
34 }
35
36
37 - (void)testFalseDash {
38 s = @"-";
39 a = [PKTokenAssembly assemblyWithString:s];
40
41 p = [PKSymbol symbolWithString:@"+"];
42
43 PKAssembly *result = [p bestMatchFor:a];
44 TDNil(result);
45 }
46
47
48 - (void)testTrueDash {
49 s = @"-";
50 a = [PKTokenAssembly assemblyWithString:s];
51
52 p = [PKSymbol symbol];
53
54 PKAssembly *result = [p bestMatchFor:a];
55
56 TDNotNil(result);
57 TDEqualObjects(@"[-]-^", [result description]);
58 }
59
60
61 - (void)testDiscardDash {
62 s = @"-";
63 a = [PKTokenAssembly assemblyWithString:s];
64
65 p = [[PKSymbol symbolWithString:s] discard];
66
67 PKAssembly *result = [p bestMatchFor:a];
68
69 TDNotNil(result);
70 TDEqualObjects(@"[]-^", [result description]);
71 }
72 @end
Something went wrong with that request. Please try again.