Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 92 lines (68 sloc) 2.973 kB
91d8e5f @itod initial add
authored
1 //
2 // FNNotTest.m
3 // Exedore
4 //
5 // Created by Todd Ditchendorf on 7/19/09.
6 // Copyright 2009 Todd Ditchendorf. All rights reserved.
7 //
8
9 #import "FNNotTest.h"
10
11 @implementation FNNotTest
12
13 - (void)setUp {
14 p = [[[XPParser alloc] init] autorelease];
15 }
16
17
18 - (void)testErrors {
19 // expr = [XPExpression expressionFromString:@"not(1, 2)" inContext:nil error:nil];
20 // STAssertThrowsSpecificNamed([expr simplify], NSException, @"XPathException", @"");
21 //
22 // expr = [XPExpression expressionFromString:@"not()" inContext:nil error:nil];
23 // STAssertThrowsSpecificNamed([expr simplify], NSException, @"XPathException", @"");
24 }
25
26
27 - (void)testBoolean {
28 expr = [XPExpression expressionFromString:@"not(false())" inContext:nil error:nil];
29 res = [expr evaluateAsBooleanInContext:nil];
30 TDTrue(res);
31
32 expr = [XPExpression expressionFromString:@"not(true())" inContext:nil error:nil];
33 res = [expr evaluateAsBooleanInContext:nil];
34 TDFalse(res);
35 }
36
37
38 - (void)testRelational {
39 expr = [XPExpression expressionFromString:@"not(1 > 2)" inContext:nil error:nil];
40 res = [expr evaluateAsBooleanInContext:nil];
41 TDTrue(res);
42
43 expr = [XPExpression expressionFromString:@"not(1 < 2)" inContext:nil error:nil];
44 res = [expr evaluateAsBooleanInContext:nil];
45 TDFalse(res);
46 }
47
48
49 - (void)testEquality {
50 expr = [XPExpression expressionFromString:@"not(true() = false())" inContext:nil error:nil];
51 res = [expr evaluateAsBooleanInContext:nil];
52 TDTrue(res);
53
54 expr = [XPExpression expressionFromString:@"not(true() != true())" inContext:nil error:nil];
55 res = [expr evaluateAsBooleanInContext:nil];
56 TDTrue(res);
57
58 expr = [XPExpression expressionFromString:@"not(true() = true())" inContext:nil error:nil];
59 res = [expr evaluateAsBooleanInContext:nil];
60 TDFalse(res);
61
62 expr = [XPExpression expressionFromString:@"not(false() != true())" inContext:nil error:nil];
63 res = [expr evaluateAsBooleanInContext:nil];
64 TDFalse(res);
65
66 expr = [XPExpression expressionFromString:@"not('foo' = 'foo')" inContext:nil error:nil];
67 res = [expr evaluateAsBooleanInContext:nil];
68 TDFalse(res);
69
70 expr = [XPExpression expressionFromString:@"not(1 = '1')" inContext:nil error:nil];
71 res = [expr evaluateAsBooleanInContext:nil];
72 TDFalse(res);
73
74 expr = [XPExpression expressionFromString:@"not(1 = --1)" inContext:nil error:nil];
75 res = [expr evaluateAsBooleanInContext:nil];
76 TDFalse(res);
77
78 expr = [XPExpression expressionFromString:@"not(1 = ---1)" inContext:nil error:nil];
79 res = [expr evaluateAsBooleanInContext:nil];
80 TDTrue(res);
81
82 expr = [XPExpression expressionFromString:@"not(-1)" inContext:nil error:nil];
83 res = [expr evaluateAsBooleanInContext:nil];
84 TDFalse(res);
85
86 expr = [XPExpression expressionFromString:@"not(---1)" inContext:nil error:nil];
87 res = [expr evaluateAsBooleanInContext:nil];
88 TDFalse(res);
89 }
90
91 @end
Something went wrong with that request. Please try again.