trackler 2.0.8.34 → 2.0.8.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/c/exercises/phone-number/src/example.c +6 -6
- data/tracks/c/exercises/phone-number/test/test_phone_number.c +50 -5
- data/tracks/csharp/exercises/beer-song/BeerSong.cs +2 -2
- data/tracks/csharp/exercises/beer-song/BeerSongTest.cs +390 -0
- data/tracks/csharp/exercises/beer-song/Example.cs +3 -8
- data/tracks/csharp/exercises/wordy/Example.cs +3 -3
- data/tracks/csharp/exercises/wordy/Wordy.cs +2 -2
- data/tracks/csharp/exercises/wordy/WordyTest.cs +35 -35
- data/tracks/csharp/generators/Data/CanonicalDataValue.cs +17 -3
- data/tracks/csharp/generators/Exercises/BeerSongExercise.cs +33 -0
- data/tracks/csharp/generators/Exercises/EqualityExercise.cs +6 -1
- data/tracks/csharp/generators/Exercises/FoodChainExercise.cs +1 -1
- data/tracks/csharp/generators/Exercises/HelloWorldExercise.cs +9 -0
- data/tracks/csharp/generators/Exercises/NthPrimeExercise.cs +7 -8
- data/tracks/csharp/generators/Exercises/WordyExercise.cs +20 -0
- data/tracks/csharp/generators/Methods/TestMethodOptions.cs +1 -0
- data/tracks/elixir/README.md +1 -1
- data/tracks/go/config.json +9 -0
- data/tracks/go/exercises/accumulate/accumulate.go +5 -0
- data/tracks/go/exercises/change/cases_test.go +83 -0
- data/tracks/go/exercises/change/change_test.go +48 -0
- data/tracks/go/exercises/change/example.go +153 -0
- data/tracks/go/exercises/change/example_gen.go +96 -0
- data/tracks/java/exercises/beer-song/src/example/java/BeerSong.java +4 -7
- data/tracks/java/exercises/beer-song/src/test/java/BeerSongTest.java +15 -7
- data/tracks/julia/img/icon.png +0 -0
- data/tracks/julia/img/icon.svg +49 -11
- data/tracks/objective-c/exercises/bracket-push/BracketPushExample.h +0 -1
- data/tracks/objective-c/exercises/bracket-push/BracketPushExample.m +41 -379
- data/tracks/objective-c/exercises/bracket-push/BracketPushTest.m +12 -32
- data/tracks/objective-c/exercises/sublist/SublistExample.h +8 -1
- data/tracks/objective-c/exercises/sublist/SublistExample.m +27 -42
- data/tracks/objective-c/exercises/sublist/SublistTest.m +17 -20
- data/tracks/python/exercises/say/say_test.py +16 -11
- data/tracks/scala/exercises/pangram/src/test/scala/PangramTest.scala +6 -5
- data/tracks/swift/exercises/bob/Sources/BobExample.swift +2 -2
- data/tracks/swift/exercises/bob/Tests/BobTests/BobTests.swift +8 -8
- metadata +11 -3
- data/tracks/csharp/exercises/beer-song/BeerTest.cs +0 -22
@@ -1,386 +1,48 @@
|
|
1
1
|
#import "BracketPushExample.h"
|
2
2
|
|
3
|
-
static NSMutableDictionary *parentheses;
|
4
|
-
static NSMutableDictionary *curlyBraces;
|
5
|
-
static NSMutableDictionary *squareBrackets;
|
6
|
-
static NSMutableArray *bracketType;
|
7
|
-
static NSString *inputString = @"";
|
8
|
-
static bool parenthesesPaired = false;
|
9
|
-
static bool curlyBracesPaired = false;
|
10
|
-
static bool squareBracesPaired = false;
|
11
|
-
static bool roundAndCurlyPaired = false;
|
12
|
-
static bool curlyAndSquarePaired =false;
|
13
|
-
static bool roundAndSquarePaired = false;
|
14
|
-
|
15
3
|
@implementation BracketPushExample
|
16
4
|
|
17
|
-
+ (BOOL)validateBracketPairingAndNestingInString:(NSString *)string{
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
return false;
|
60
|
-
}
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
+ (BOOL)checkPairingOfAllBrackets{
|
66
|
-
|
67
|
-
|
68
|
-
bool result = false;
|
69
|
-
parenthesesPaired = [bracketType containsObject:parentheses]?[[parentheses objectForKey:@"("] intValue] == [[parentheses objectForKey:@")"] intValue]:false;
|
70
|
-
curlyBracesPaired = [bracketType containsObject:curlyBraces]?[[curlyBraces objectForKey:@"{"] intValue] == [[curlyBraces objectForKey:@"}"] intValue]:false;
|
71
|
-
squareBracesPaired = [bracketType containsObject:squareBrackets]?[[squareBrackets objectForKey:@"["] intValue] == [[squareBrackets objectForKey:@"]"] intValue]:false;
|
72
|
-
switch((int)bracketType.count){
|
73
|
-
|
74
|
-
case 1: result = [BracketPushExample checkBracketPairingOneAtATime];
|
75
|
-
break;
|
76
|
-
|
77
|
-
case 2: result = [BracketPushExample checkBracketPairingTwoAtATime];
|
78
|
-
break;
|
79
|
-
|
80
|
-
case 3: result = parenthesesPaired && curlyBracesPaired && squareBracesPaired;
|
81
|
-
break;
|
82
|
-
|
83
|
-
default:break;
|
84
|
-
|
85
|
-
}
|
86
|
-
|
87
|
-
return result;
|
88
|
-
}
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
+ (NSString*)getClosingBracketForOpeningBracket:(NSString*)opener{
|
94
|
-
|
95
|
-
if([opener isEqualToString:@"("]){
|
96
|
-
|
97
|
-
return @")";
|
98
|
-
}else if([opener isEqualToString:@"{"]){
|
99
|
-
|
100
|
-
return @"}";
|
101
|
-
}else if([opener isEqualToString:@"["]){
|
102
|
-
|
103
|
-
return @"]";
|
104
|
-
}
|
105
|
-
|
106
|
-
return @"";
|
107
|
-
}
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
+ (BOOL)checkBracketPairingTwoAtATime{
|
112
|
-
|
113
|
-
if(parenthesesPaired && curlyBracesPaired){
|
114
|
-
|
115
|
-
roundAndCurlyPaired=true;
|
116
|
-
|
117
|
-
}else if(curlyBracesPaired && squareBracesPaired){
|
118
|
-
|
119
|
-
curlyAndSquarePaired=true;
|
120
|
-
}else if(squareBracesPaired && parenthesesPaired){
|
121
|
-
|
122
|
-
roundAndSquarePaired=true;
|
123
|
-
}
|
124
|
-
return (roundAndCurlyPaired) || (curlyAndSquarePaired) || (roundAndSquarePaired);
|
125
|
-
}
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
+ (BOOL)checkBracketPairingOneAtATime{
|
131
|
-
|
132
|
-
return (parenthesesPaired || curlyBracesPaired || squareBracesPaired);
|
133
|
-
}
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
+ (void)checkBracketType:(NSString*)bracket inString:(NSString*)string{
|
138
|
-
|
139
|
-
if([string rangeOfString:bracket].location != NSNotFound){
|
140
|
-
|
141
|
-
if([bracket isEqualToString:@"("] || [bracket isEqualToString:@")"]){
|
142
|
-
|
143
|
-
parentheses[bracket] = [NSNumber numberWithInteger:[string componentsSeparatedByString:bracket].count - 1];
|
144
|
-
|
145
|
-
|
146
|
-
}else if([bracket isEqualToString:@"{"] || [bracket isEqualToString:@"}"]){
|
147
|
-
|
148
|
-
curlyBraces[bracket] = [NSNumber numberWithInteger:[string componentsSeparatedByString:bracket].count - 1];
|
149
|
-
|
150
|
-
}else if([bracket isEqualToString:@"["] || [bracket isEqualToString:@"]"]){
|
151
|
-
|
152
|
-
squareBrackets[bracket] = [NSNumber numberWithInteger:[string componentsSeparatedByString:bracket].count - 1];
|
153
|
-
|
154
|
-
}
|
155
|
-
}
|
156
|
-
|
157
|
-
}
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
+ (BOOL)checkBracketNestingForAllBrackets{
|
163
|
-
|
164
|
-
bool result = false;
|
165
|
-
switch (bracketType.count) {
|
166
|
-
|
167
|
-
case 1: if([bracketType containsObject:parentheses]){
|
168
|
-
|
169
|
-
result = [BracketPushExample checkNestingOfBracketsOneAtATimeWithOpener:@"(" andCloser:@")"];
|
170
|
-
|
171
|
-
}else if([bracketType containsObject:curlyBraces]){
|
172
|
-
|
173
|
-
result = [BracketPushExample checkNestingOfBracketsOneAtATimeWithOpener:@"{" andCloser:@"}"];
|
174
|
-
|
175
|
-
}else if([bracketType containsObject:squareBrackets]){
|
176
|
-
|
177
|
-
result = [BracketPushExample checkNestingOfBracketsOneAtATimeWithOpener:@"[" andCloser:@"]"];
|
178
|
-
}
|
179
|
-
break;
|
180
|
-
|
181
|
-
|
182
|
-
case 2: if(roundAndCurlyPaired){
|
183
|
-
|
184
|
-
result = [BracketPushExample checkNestingOfBracketsTwoAtATime:@"({"];
|
185
|
-
|
186
|
-
|
187
|
-
}else if(curlyAndSquarePaired){
|
188
|
-
|
189
|
-
result = [BracketPushExample checkNestingOfBracketsTwoAtATime:@"{["];
|
190
|
-
|
191
|
-
}else if(roundAndSquarePaired){
|
192
|
-
|
193
|
-
result = [BracketPushExample checkNestingOfBracketsTwoAtATime:@"[("];
|
194
|
-
|
195
|
-
}
|
196
|
-
|
197
|
-
break;
|
198
|
-
|
199
|
-
|
200
|
-
case 3: result = [BracketPushExample checkNestingOfBracketsThreeAtATime];
|
201
|
-
break;
|
202
|
-
|
203
|
-
|
204
|
-
default:break;
|
205
|
-
}
|
206
|
-
return result;
|
207
|
-
}
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
+ (BOOL)checkNestingOfBracketsOneAtATimeWithOpener:(NSString*)opener andCloser:(NSString*)closer{
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
NSScanner *openScanner = [NSScanner scannerWithString:inputString];
|
217
|
-
NSScanner *closeScanner = [NSScanner scannerWithString:inputString];
|
218
|
-
[openScanner scanUpToString:opener intoString:nil];
|
219
|
-
[closeScanner scanUpToString:closer intoString:nil];
|
220
|
-
while(!openScanner.isAtEnd && !closeScanner.isAtEnd){
|
221
|
-
|
222
|
-
if(openScanner.scanLocation > closeScanner.scanLocation){
|
223
|
-
|
224
|
-
return false;
|
225
|
-
}
|
226
|
-
[openScanner setScanLocation:openScanner.scanLocation+1];
|
227
|
-
[closeScanner setScanLocation:closeScanner.scanLocation+1];
|
228
|
-
[openScanner scanUpToString:opener intoString:nil];
|
229
|
-
[closeScanner scanUpToString:closer intoString:nil];
|
230
|
-
}
|
231
|
-
|
232
|
-
|
233
|
-
return true;
|
234
|
-
}
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
+ (BOOL)checkNestingOfBracketsTwoAtATime:(NSString*)bracketTypeString{
|
240
|
-
|
241
|
-
int opener1Occurence = 0;
|
242
|
-
int closer1Occurence = 0;
|
243
|
-
int opener2Occurence = 0;
|
244
|
-
int closer2Occurence = 0;
|
245
|
-
NSScanner *opener1 = [NSScanner scannerWithString:inputString];
|
246
|
-
NSScanner *closer1= [NSScanner scannerWithString:inputString];
|
247
|
-
NSScanner *opener2= [NSScanner scannerWithString:inputString];
|
248
|
-
NSScanner *closer2= [NSScanner scannerWithString:inputString];
|
249
|
-
|
250
|
-
NSString *openingBracket1 = [NSString stringWithFormat:@"%c",[bracketTypeString characterAtIndex:0]];
|
251
|
-
NSString *openingBracket2 = [NSString stringWithFormat:@"%c",[bracketTypeString characterAtIndex:1]];
|
252
|
-
NSString *closingBracket1 = [BracketPushExample getClosingBracketForOpeningBracket:openingBracket1];
|
253
|
-
NSString *closingBracket2 = [BracketPushExample getClosingBracketForOpeningBracket:openingBracket2];
|
254
|
-
|
255
|
-
[opener1 scanUpToString:openingBracket1 intoString:nil];
|
256
|
-
[opener2 scanUpToString:openingBracket2 intoString:nil];
|
257
|
-
[closer1 scanUpToString:closingBracket1 intoString:nil];
|
258
|
-
[closer2 scanUpToString:closingBracket2 intoString:nil];
|
259
|
-
|
260
|
-
while(!opener1.isAtEnd && !opener2.isAtEnd && !closer1.isAtEnd && !closer2.isAtEnd){
|
261
|
-
|
262
|
-
opener1Occurence++;
|
263
|
-
opener2Occurence++;
|
264
|
-
closer1Occurence++;
|
265
|
-
closer2Occurence++;
|
266
|
-
|
267
|
-
if(opener1.scanLocation < opener2.scanLocation){
|
268
|
-
|
269
|
-
if(closer2.scanLocation != opener2.scanLocation + 1 && closer2.scanLocation > closer1.scanLocation && opener2Occurence == 1){
|
270
|
-
|
271
|
-
|
272
|
-
return false;
|
273
|
-
|
274
|
-
|
275
|
-
}
|
276
|
-
|
277
|
-
}else{
|
278
|
-
|
279
|
-
if(closer1.scanLocation > closer2.scanLocation && closer1.scanLocation != opener1.scanLocation + 1 && opener1Occurence == 1){
|
280
|
-
|
281
|
-
return false;
|
282
|
-
|
283
|
-
}
|
284
|
-
}
|
285
|
-
[opener1 setScanLocation:opener1.scanLocation+1];
|
286
|
-
[opener2 setScanLocation:opener2.scanLocation+1];
|
287
|
-
[closer1 setScanLocation:closer1.scanLocation+1];
|
288
|
-
[closer2 setScanLocation:closer2.scanLocation+1];
|
289
|
-
[opener1 scanUpToString:openingBracket1 intoString:nil];
|
290
|
-
[opener2 scanUpToString:openingBracket2 intoString:nil];
|
291
|
-
[closer1 scanUpToString:closingBracket1 intoString:nil];
|
292
|
-
[closer2 scanUpToString:closingBracket2 intoString:nil];
|
293
|
-
|
294
|
-
}
|
295
|
-
return true;
|
296
|
-
}
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
+ (BOOL)checkNestingOfBracketsThreeAtATime{
|
303
|
-
|
304
|
-
NSString *orderOfoccurence = [BracketPushExample checkOrderOfOccurenceOfThreeBracketTypes];
|
305
|
-
NSString *opener1 = [NSString stringWithFormat:@"%c",[orderOfoccurence characterAtIndex:0]];
|
306
|
-
NSString *opener2 = [NSString stringWithFormat:@"%c",[orderOfoccurence characterAtIndex:1]];
|
307
|
-
NSString *opener3 = [NSString stringWithFormat:@"%c",[orderOfoccurence characterAtIndex:2]];
|
308
|
-
NSString *closer1 = [BracketPushExample getClosingBracketForOpeningBracket:opener1];
|
309
|
-
NSString *closer2 = [BracketPushExample getClosingBracketForOpeningBracket:opener2];
|
310
|
-
NSString *closer3 = [BracketPushExample getClosingBracketForOpeningBracket:opener3];
|
311
|
-
|
312
|
-
NSScanner *scanner = [NSScanner scannerWithString:inputString];
|
313
|
-
NSScanner *scanner1 = [NSScanner scannerWithString:inputString];
|
314
|
-
NSScanner *scanner2 = [NSScanner scannerWithString:inputString];
|
315
|
-
NSScanner *scanner3 = [NSScanner scannerWithString:inputString];
|
316
|
-
|
317
|
-
[scanner scanUpToString:opener1 intoString:nil];
|
318
|
-
[scanner1 scanUpToString:closer1 intoString:nil];
|
319
|
-
[scanner2 scanUpToString:closer2 intoString:nil];
|
320
|
-
[scanner3 scanUpToString:closer3 intoString:nil];
|
321
|
-
|
322
|
-
while(!scanner.isAtEnd && !scanner1.isAtEnd && !scanner2.isAtEnd && !scanner3.isAtEnd){
|
323
|
-
|
324
|
-
if(scanner1.scanLocation != (scanner.scanLocation + 1) && scanner1.scanLocation < scanner2.scanLocation && scanner1.scanLocation < scanner3.scanLocation){
|
325
|
-
|
326
|
-
return false;
|
327
|
-
}
|
328
|
-
scanner.scanLocation = scanner.scanLocation+1;
|
329
|
-
scanner1.scanLocation = scanner1.scanLocation+1;
|
330
|
-
scanner2.scanLocation = scanner2.scanLocation+1;
|
331
|
-
scanner3.scanLocation = scanner3.scanLocation+1;
|
332
|
-
[scanner scanUpToString:opener1 intoString:nil];
|
333
|
-
[scanner1 scanUpToString:closer1 intoString:nil];
|
334
|
-
[scanner2 scanUpToString:closer2 intoString:nil];
|
335
|
-
[scanner3 scanUpToString:closer3 intoString:nil];
|
336
|
-
}
|
337
|
-
|
338
|
-
return [BracketPushExample checkNestingOfBracketsTwoAtATime:[NSString stringWithFormat:@"%@%@",opener2,opener3]];
|
339
|
-
|
340
|
-
}
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
+ (NSString*)checkOrderOfOccurenceOfThreeBracketTypes{
|
346
|
-
|
347
|
-
NSScanner *scanner1 = [NSScanner scannerWithString:inputString];
|
348
|
-
NSScanner *scanner2 = [NSScanner scannerWithString:inputString];
|
349
|
-
NSScanner *scanner3 = [NSScanner scannerWithString:inputString];
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
[scanner1 scanUpToString:@"(" intoString:nil];
|
354
|
-
[scanner2 scanUpToString:@"{" intoString:nil];
|
355
|
-
[scanner3 scanUpToString:@"[" intoString:nil];
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
if(scanner1.scanLocation < scanner2.scanLocation && scanner1.scanLocation < scanner3.scanLocation){
|
360
|
-
|
361
|
-
if(scanner2.scanLocation < scanner3.scanLocation){
|
362
|
-
|
363
|
-
return @"({[";
|
364
|
-
}
|
365
|
-
return @"([{";
|
366
|
-
}else if(scanner2.scanLocation < scanner1.scanLocation && scanner2.scanLocation < scanner3.scanLocation){
|
367
|
-
|
368
|
-
if(scanner1.scanLocation < scanner3.scanLocation){
|
369
|
-
|
370
|
-
return @"{([";
|
371
|
-
}
|
372
|
-
return @"{[(";
|
373
|
-
|
374
|
-
}
|
375
|
-
|
376
|
-
if(scanner1.scanLocation < scanner2.scanLocation){
|
377
|
-
|
378
|
-
return @"[({";
|
379
|
-
}
|
380
|
-
return @"[{(";
|
381
|
-
|
382
|
-
|
383
|
-
|
5
|
+
+ (BOOL)validateBracketPairingAndNestingInString:(NSString *)string {
|
6
|
+
NSDictionary *brackets = @{@")" : @"(",
|
7
|
+
@"]" : @"[",
|
8
|
+
@"}" : @"{" };
|
9
|
+
|
10
|
+
NSMutableArray *stack = [[NSMutableArray alloc] init];
|
11
|
+
NSRange textRange = NSMakeRange(0, string.length);
|
12
|
+
__block BOOL mismatch = NO;
|
13
|
+
|
14
|
+
[string enumerateSubstringsInRange:textRange
|
15
|
+
options:NSStringEnumerationByComposedCharacterSequences
|
16
|
+
usingBlock:^(NSString * _Nullable
|
17
|
+
substring,
|
18
|
+
NSRange substringRange,
|
19
|
+
NSRange enclosingRange,
|
20
|
+
BOOL * _Nonnull stop)
|
21
|
+
{
|
22
|
+
if ([[brackets allValues] containsObject:substring]) {
|
23
|
+
[stack addObject:substring];
|
24
|
+
} else if ([[brackets allKeys] containsObject:substring]) {
|
25
|
+
NSString *last = [stack lastObject];
|
26
|
+
|
27
|
+
if (last) {
|
28
|
+
[stack removeLastObject];
|
29
|
+
|
30
|
+
if (![last isEqualToString:brackets[substring]]) {
|
31
|
+
mismatch = YES;
|
32
|
+
*stop = YES;
|
33
|
+
}
|
34
|
+
} else {
|
35
|
+
mismatch = YES;
|
36
|
+
*stop = YES;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}];
|
40
|
+
|
41
|
+
if (mismatch) {
|
42
|
+
return NO;
|
43
|
+
}
|
44
|
+
|
45
|
+
return [stack count] == 0;
|
384
46
|
}
|
385
47
|
|
386
48
|
@end
|
@@ -11,74 +11,54 @@
|
|
11
11
|
@implementation BracketPushTest
|
12
12
|
|
13
13
|
- (void)testPairedSquareBrackets {
|
14
|
-
|
15
14
|
XCTAssertTrue([BracketPushExample validateBracketPairingAndNestingInString:@"[]"]);
|
16
15
|
}
|
17
16
|
|
18
|
-
-(void)testEmptyString{
|
19
|
-
|
17
|
+
- (void)testEmptyString {
|
20
18
|
XCTAssertTrue([BracketPushExample validateBracketPairingAndNestingInString:@""]);
|
21
|
-
|
22
19
|
}
|
23
20
|
|
24
|
-
-(void)testUnpairedBrackets{
|
25
|
-
|
21
|
+
- (void)testUnpairedBrackets {
|
26
22
|
XCTAssertFalse([BracketPushExample validateBracketPairingAndNestingInString:@"[["]);
|
27
|
-
|
28
23
|
}
|
29
24
|
|
30
|
-
-(void)testWrongOrderedBrackets{
|
31
|
-
|
25
|
+
- (void)testWrongOrderedBrackets {
|
32
26
|
XCTAssertFalse([BracketPushExample validateBracketPairingAndNestingInString:@"}{"]);
|
33
|
-
|
34
27
|
}
|
35
28
|
|
36
|
-
-(void)testPairedWithWhitespace{
|
37
|
-
|
29
|
+
- (void)testPairedWithWhitespace {
|
38
30
|
XCTAssertTrue([BracketPushExample validateBracketPairingAndNestingInString:@"{ }"]);
|
39
|
-
|
40
31
|
}
|
41
32
|
|
42
|
-
-(void)testSimpleNestedBrackets{
|
43
|
-
|
33
|
+
- (void)testSimpleNestedBrackets {
|
44
34
|
XCTAssertTrue([BracketPushExample validateBracketPairingAndNestingInString:@"{[]}"]);
|
45
|
-
|
46
35
|
}
|
47
36
|
|
48
|
-
-(void)testSeveralPairedBrackets{
|
49
|
-
|
37
|
+
- (void)testSeveralPairedBrackets {
|
50
38
|
XCTAssertTrue([BracketPushExample validateBracketPairingAndNestingInString:@"{}[]"]);
|
51
39
|
}
|
52
40
|
|
53
|
-
-(void)testPairedAndNestedBrackets{
|
54
|
-
|
41
|
+
- (void)testPairedAndNestedBrackets {
|
55
42
|
XCTAssertTrue([BracketPushExample validateBracketPairingAndNestingInString:@"([{}({}[])])"]);
|
56
43
|
}
|
57
44
|
|
58
|
-
-(void)testUnopenedClosingBrackets{
|
59
|
-
|
45
|
+
- (void)testUnopenedClosingBrackets {
|
60
46
|
XCTAssertFalse([BracketPushExample validateBracketPairingAndNestingInString:@"{[)][]}"]);
|
61
|
-
|
62
47
|
}
|
63
48
|
|
64
|
-
-(void)testUnpairedAndNestedBrackets{
|
65
|
-
|
49
|
+
- (void)testUnpairedAndNestedBrackets {
|
66
50
|
XCTAssertFalse([BracketPushExample validateBracketPairingAndNestingInString:@"([{])"]);
|
67
51
|
}
|
68
52
|
|
69
|
-
-(void)testPairedAndWrongNestedBrackets{
|
70
|
-
|
53
|
+
- (void)testPairedAndWrongNestedBrackets {
|
71
54
|
XCTAssertFalse([BracketPushExample validateBracketPairingAndNestingInString:@"[({]})"]);
|
72
|
-
|
73
55
|
}
|
74
56
|
|
75
|
-
-(void)testMathExpression{
|
76
|
-
|
57
|
+
- (void)testMathExpression {
|
77
58
|
XCTAssertTrue([BracketPushExample validateBracketPairingAndNestingInString:@"(((185 + 223.85) * 15) - 543)/2"]);
|
78
59
|
}
|
79
60
|
|
80
|
-
-(void)testComplexLatexExpression{
|
81
|
-
|
61
|
+
- (void)testComplexLatexExpression {
|
82
62
|
XCTAssertTrue([BracketPushExample validateBracketPairingAndNestingInString:@"\\left(\\begin{array}{cc} \\frac{1}{3} & x\\\\ \\mathrm{e}^{x} &... x^2 \\end{array}\\right)"]);
|
83
63
|
}
|
84
64
|
@end
|