trackler 2.0.8.28 → 2.0.8.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/common/CONTRIBUTING.md +4 -1
- data/common/README.md +52 -0
- data/lib/trackler/version.rb +1 -1
- data/tracks/ecmascript/config.json +7 -0
- data/tracks/ecmascript/exercises/perfect-numbers/example.js +68 -0
- data/tracks/ecmascript/exercises/perfect-numbers/gulpfile.js +89 -0
- data/tracks/ecmascript/exercises/perfect-numbers/package.json +28 -0
- data/tracks/ecmascript/exercises/perfect-numbers/perfect-numbers.spec.js +75 -0
- data/tracks/erlang/exercises/accumulate/src/accumulate.app.src +1 -1
- data/tracks/erlang/exercises/all-your-base/src/all_your_base.app.src +1 -1
- data/tracks/erlang/exercises/allergies/src/allergies.app.src +1 -1
- data/tracks/erlang/exercises/anagram/src/anagram.app.src +1 -1
- data/tracks/erlang/exercises/atbash-cipher/src/atbash_cipher.app.src +1 -1
- data/tracks/erlang/exercises/bank-account/src/bank_account.app.src +1 -1
- data/tracks/erlang/exercises/beer-song/src/beer_song.app.src +1 -1
- data/tracks/erlang/exercises/bob/src/bob.app.src +1 -1
- data/tracks/erlang/exercises/circular-buffer/src/circular_buffer.app.src +1 -1
- data/tracks/erlang/exercises/clock/src/clock.app.src +1 -1
- data/tracks/erlang/exercises/difference-of-squares/src/difference_of_squares.app.src +1 -1
- data/tracks/erlang/exercises/etl/src/etl.app.src +1 -1
- data/tracks/erlang/exercises/gigasecond/src/gigasecond.app.src +1 -1
- data/tracks/erlang/exercises/grade-school/src/grade_school.app.src +1 -1
- data/tracks/erlang/exercises/grains/src/grains.app.src +1 -1
- data/tracks/erlang/exercises/hamming/src/hamming.app.src +1 -1
- data/tracks/erlang/exercises/hello-world/src/hello_world.app.src +1 -1
- data/tracks/erlang/exercises/largest-series-product/src/largest_series_product.app.src +1 -1
- data/tracks/erlang/exercises/leap/src/leap.app.src +1 -1
- data/tracks/erlang/exercises/luhn/src/luhn.app.src +1 -1
- data/tracks/erlang/exercises/meetup/src/meetup.app.src +1 -1
- data/tracks/erlang/exercises/nucleotide-count/src/nucleotide_count.app.src +1 -1
- data/tracks/erlang/exercises/parallel-letter-frequency/src/parallel_letter_frequency.app.src +1 -1
- data/tracks/erlang/exercises/phone-number/src/phone_number.app.src +1 -1
- data/tracks/erlang/exercises/rna-transcription/src/rna_transcription.app.src +1 -1
- data/tracks/erlang/exercises/robot-simulator/src/robot_simulator.app.src +1 -1
- data/tracks/erlang/exercises/roman-numerals/src/roman_numerals.app.src +1 -1
- data/tracks/erlang/exercises/rotational-cipher/src/rotational_cipher.app.src +1 -1
- data/tracks/erlang/exercises/scrabble-score/src/scrabble_score.app.src +1 -1
- data/tracks/erlang/exercises/series/src/series.app.src +1 -1
- data/tracks/erlang/exercises/space-age/src/space_age.app.src +1 -1
- data/tracks/erlang/exercises/strain/src/strain.app.src +1 -1
- data/tracks/erlang/exercises/sum-of-multiples/src/sum_of_multiples.app.src +1 -1
- data/tracks/erlang/exercises/triangle/src/triangle.app.src +1 -1
- data/tracks/erlang/exercises/word-count/src/word_count.app.src +1 -1
- data/tracks/erlang/exercises/zipper/src/zipper.app.src +1 -1
- data/tracks/go/exercises/hello-world/hello_world.go +10 -1
- data/tracks/haskell/exercises/simple-linked-list/examples/success-standard/package.yaml +1 -0
- data/tracks/haskell/exercises/simple-linked-list/examples/success-standard/src/LinkedList.hs +1 -0
- data/tracks/haskell/exercises/simple-linked-list/package.yaml +1 -0
- data/tracks/haskell/exercises/simple-linked-list/src/LinkedList.hs +1 -1
- data/tracks/haskell/exercises/simple-linked-list/test/Tests.hs +37 -1
- data/tracks/java/exercises/diamond/src/test/java/DiamondPrinterTest.java +13 -6
- data/tracks/java/exercises/secret-handshake/src/test/java/HandshakeCalculatorTest.java +21 -13
- data/tracks/objective-c/exercises/atbash-cipher/AtbashCipherExample.m +1 -1
- data/tracks/objective-c/exercises/beer-song/BeerSongExample.m +1 -1
- data/tracks/objective-c/exercises/beer-song/BeerSongTest.m +4 -4
- data/tracks/objective-c/exercises/binary-search/BinarySearchExample.m +1 -1
- data/tracks/objective-c/exercises/flatten-array/FlattenArrayExample.h +2 -1
- data/tracks/objective-c/exercises/flatten-array/FlattenArrayExample.m +12 -25
- data/tracks/objective-c/exercises/flatten-array/FlattenArrayTest.m +32 -80
- data/tracks/objective-c/exercises/sublist/SublistTest.m +47 -70
- data/tracks/perl6/exercises/allergies/Allergies.pm6 +1 -0
- data/tracks/perl6/exercises/allergies/Example.pm +3 -1
- data/tracks/perl6/exercises/allergies/allergies.t +187 -137
- data/tracks/perl6/exercises/anagram/Anagram.pm6 +1 -0
- data/tracks/perl6/exercises/anagram/Example.pm +15 -15
- data/tracks/perl6/exercises/anagram/anagram.t +164 -15
- data/tracks/perl6/exercises/atbash-cipher/AtbashCipher.pm6 +1 -0
- data/tracks/perl6/exercises/atbash-cipher/Example.pm +2 -0
- data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +109 -86
- data/tracks/perl6/exercises/grains/Example.pm +10 -9
- data/tracks/perl6/exercises/grains/Grains.pm6 +1 -0
- data/tracks/perl6/exercises/grains/grains.t +126 -18
- data/tracks/perl6/exercises/leap/Example.pm +9 -9
- data/tracks/perl6/exercises/leap/Leap.pm6 +4 -0
- data/tracks/perl6/exercises/leap/leap.t +61 -17
- data/tracks/perl6/exercises/phone-number/Example.pm +4 -28
- data/tracks/perl6/exercises/phone-number/PhoneNumber.pm6 +4 -0
- data/tracks/perl6/exercises/phone-number/phone-number.t +102 -65
- data/tracks/perl6/exercises/raindrops/Example.pm +10 -8
- data/tracks/perl6/exercises/raindrops/Raindrops.pm6 +4 -0
- data/tracks/perl6/exercises/raindrops/raindrops.t +153 -20
- data/tracks/perl6/exercises/rna-transcription/Example.pm +5 -7
- data/tracks/perl6/exercises/rna-transcription/RNA.pm6 +4 -0
- data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +107 -11
- data/tracks/perl6/exercises/scrabble-score/Example.pm +14 -19
- data/tracks/perl6/exercises/scrabble-score/Scrabble.pm6 +4 -0
- data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +106 -15
- data/tracks/perl6/exercises/space-age/Example.pm +29 -13
- data/tracks/perl6/exercises/space-age/SpaceAge.pm6 +22 -0
- data/tracks/perl6/exercises/space-age/space-age.t +90 -52
- data/tracks/perl6/exercises/word-count/Example.pm +4 -8
- data/tracks/perl6/exercises/word-count/WordCount.pm6 +4 -0
- data/tracks/perl6/exercises/word-count/word-count.t +149 -16
- data/tracks/perl6/exercises/wordy/Example.pm +13 -13
- data/tracks/perl6/exercises/wordy/Wordy.pm6 +4 -0
- data/tracks/perl6/exercises/wordy/wordy.t +140 -97
- data/tracks/purescript/config.json +7 -0
- data/tracks/purescript/exercises/atbash-cipher/bower.json +18 -0
- data/tracks/purescript/exercises/atbash-cipher/examples/src/AtbashCipher.purs +41 -0
- data/tracks/purescript/exercises/atbash-cipher/src/AtbashCipher.purs +4 -0
- data/tracks/purescript/exercises/atbash-cipher/test/Main.purs +64 -0
- data/tracks/python/exercises/run-length-encoding/run_length_encoding_test.py +2 -0
- data/tracks/swift/exercises/grade-school/Tests/GradeSchoolTests/GradeSchoolTests.swift +1 -1
- metadata +22 -2
@@ -27,7 +27,7 @@ static NSDictionary<NSString *, NSString *> *cipherDictionary;
|
|
27
27
|
}
|
28
28
|
|
29
29
|
+ (NSString *)encode:(NSString *)input {
|
30
|
-
input = [input lowercaseString];
|
30
|
+
input = [input lowercaseString]; //!OCLint
|
31
31
|
|
32
32
|
NSCharacterSet *characterSet = [NSCharacterSet alphanumericCharacterSet];
|
33
33
|
NSMutableString *result = [[NSMutableString alloc] init];
|
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
-(void)testVersesForOneBeerBottle{
|
24
24
|
BeerSongExample *songExample = [[BeerSongExample alloc]initWithNumberOfBeerBottles:1];
|
25
|
-
NSString* expectedVerses = @"1 bottle of beer on the wall, 1 bottle of beer.\nTake one down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.";
|
25
|
+
NSString* expectedVerses = @"1 bottle of beer on the wall, 1 bottle of beer.\nTake one down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall."; //!OCLint
|
26
26
|
XCTAssertEqualObjects(expectedVerses, [songExample singBeerSong]);
|
27
27
|
|
28
28
|
}
|
@@ -30,21 +30,21 @@
|
|
30
30
|
-(void)testVersesForTwoBeerBottles{
|
31
31
|
|
32
32
|
BeerSongExample *songExample = [[BeerSongExample alloc]initWithNumberOfBeerBottles:2];
|
33
|
-
NSString* expectedVerses = @"2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake one down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.";
|
33
|
+
NSString* expectedVerses = @"2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake one down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall."; //!OCLint
|
34
34
|
XCTAssertEqualObjects(expectedVerses, [songExample singBeerSong]);
|
35
35
|
}
|
36
36
|
|
37
37
|
-(void)testVersesForSeventyFiveBeerBottles{
|
38
38
|
|
39
39
|
BeerSongExample *songExample = [[BeerSongExample alloc]initWithNumberOfBeerBottles:75];
|
40
|
-
NSString* expectedVerses = @"75 bottles of beer on the wall, 75 bottles of beer.\nTake one down and pass it around, 74 bottles of beer on the wall.\n\n74 bottles of beer on the wall, 74 bottles of beer.\nTake one down and pass it around, 73 bottles of beer on the wall.\n\n73 bottles of beer on the wall, 73 bottles of beer.\nTake one down and pass it around, 72 bottles of beer on the wall.\n\n72 bottles of beer on the wall, 72 bottles of beer.\nTake one down and pass it around, 71 bottles of beer on the wall.\n\n71 bottles of beer on the wall, 71 bottles of beer.\nTake one down and pass it around, 70 bottles of beer on the wall.\n\n70 bottles of beer on the wall, 70 bottles of beer.\nTake one down and pass it around, 69 bottles of beer on the wall.\n\n69 bottles of beer on the wall, 69 bottles of beer.\nTake one down and pass it around, 68 bottles of beer on the wall.\n\n68 bottles of beer on the wall, 68 bottles of beer.\nTake one down and pass it around, 67 bottles of beer on the wall.\n\n67 bottles of beer on the wall, 67 bottles of beer.\nTake one down and pass it around, 66 bottles of beer on the wall.\n\n66 bottles of beer on the wall, 66 bottles of beer.\nTake one down and pass it around, 65 bottles of beer on the wall.\n\n65 bottles of beer on the wall, 65 bottles of beer.\nTake one down and pass it around, 64 bottles of beer on the wall.\n\n64 bottles of beer on the wall, 64 bottles of beer.\nTake one down and pass it around, 63 bottles of beer on the wall.\n\n63 bottles of beer on the wall, 63 bottles of beer.\nTake one down and pass it around, 62 bottles of beer on the wall.\n\n62 bottles of beer on the wall, 62 bottles of beer.\nTake one down and pass it around, 61 bottles of beer on the wall.\n\n61 bottles of beer on the wall, 61 bottles of beer.\nTake one down and pass it around, 60 bottles of beer on the wall.\n\n60 bottles of beer on the wall, 60 bottles of beer.\nTake one down and pass it around, 59 bottles of beer on the wall.\n\n59 bottles of beer on the wall, 59 bottles of beer.\nTake one down and pass it around, 58 bottles of beer on the wall.\n\n58 bottles of beer on the wall, 58 bottles of beer.\nTake one down and pass it around, 57 bottles of beer on the wall.\n\n57 bottles of beer on the wall, 57 bottles of beer.\nTake one down and pass it around, 56 bottles of beer on the wall.\n\n56 bottles of beer on the wall, 56 bottles of beer.\nTake one down and pass it around, 55 bottles of beer on the wall.\n\n55 bottles of beer on the wall, 55 bottles of beer.\nTake one down and pass it around, 54 bottles of beer on the wall.\n\n54 bottles of beer on the wall, 54 bottles of beer.\nTake one down and pass it around, 53 bottles of beer on the wall.\n\n53 bottles of beer on the wall, 53 bottles of beer.\nTake one down and pass it around, 52 bottles of beer on the wall.\n\n52 bottles of beer on the wall, 52 bottles of beer.\nTake one down and pass it around, 51 bottles of beer on the wall.\n\n51 bottles of beer on the wall, 51 bottles of beer.\nTake one down and pass it around, 50 bottles of beer on the wall.\n\n50 bottles of beer on the wall, 50 bottles of beer.\nTake one down and pass it around, 49 bottles of beer on the wall.\n\n49 bottles of beer on the wall, 49 bottles of beer.\nTake one down and pass it around, 48 bottles of beer on the wall.\n\n48 bottles of beer on the wall, 48 bottles of beer.\nTake one down and pass it around, 47 bottles of beer on the wall.\n\n47 bottles of beer on the wall, 47 bottles of beer.\nTake one down and pass it around, 46 bottles of beer on the wall.\n\n46 bottles of beer on the wall, 46 bottles of beer.\nTake one down and pass it around, 45 bottles of beer on the wall.\n\n45 bottles of beer on the wall, 45 bottles of beer.\nTake one down and pass it around, 44 bottles of beer on the wall.\n\n44 bottles of beer on the wall, 44 bottles of beer.\nTake one down and pass it around, 43 bottles of beer on the wall.\n\n43 bottles of beer on the wall, 43 bottles of beer.\nTake one down and pass it around, 42 bottles of beer on the wall.\n\n42 bottles of beer on the wall, 42 bottles of beer.\nTake one down and pass it around, 41 bottles of beer on the wall.\n\n41 bottles of beer on the wall, 41 bottles of beer.\nTake one down and pass it around, 40 bottles of beer on the wall.\n\n40 bottles of beer on the wall, 40 bottles of beer.\nTake one down and pass it around, 39 bottles of beer on the wall.\n\n39 bottles of beer on the wall, 39 bottles of beer.\nTake one down and pass it around, 38 bottles of beer on the wall.\n\n38 bottles of beer on the wall, 38 bottles of beer.\nTake one down and pass it around, 37 bottles of beer on the wall.\n\n37 bottles of beer on the wall, 37 bottles of beer.\nTake one down and pass it around, 36 bottles of beer on the wall.\n\n36 bottles of beer on the wall, 36 bottles of beer.\nTake one down and pass it around, 35 bottles of beer on the wall.\n\n35 bottles of beer on the wall, 35 bottles of beer.\nTake one down and pass it around, 34 bottles of beer on the wall.\n\n34 bottles of beer on the wall, 34 bottles of beer.\nTake one down and pass it around, 33 bottles of beer on the wall.\n\n33 bottles of beer on the wall, 33 bottles of beer.\nTake one down and pass it around, 32 bottles of beer on the wall.\n\n32 bottles of beer on the wall, 32 bottles of beer.\nTake one down and pass it around, 31 bottles of beer on the wall.\n\n31 bottles of beer on the wall, 31 bottles of beer.\nTake one down and pass it around, 30 bottles of beer on the wall.\n\n30 bottles of beer on the wall, 30 bottles of beer.\nTake one down and pass it around, 29 bottles of beer on the wall.\n\n29 bottles of beer on the wall, 29 bottles of beer.\nTake one down and pass it around, 28 bottles of beer on the wall.\n\n28 bottles of beer on the wall, 28 bottles of beer.\nTake one down and pass it around, 27 bottles of beer on the wall.\n\n27 bottles of beer on the wall, 27 bottles of beer.\nTake one down and pass it around, 26 bottles of beer on the wall.\n\n26 bottles of beer on the wall, 26 bottles of beer.\nTake one down and pass it around, 25 bottles of beer on the wall.\n\n25 bottles of beer on the wall, 25 bottles of beer.\nTake one down and pass it around, 24 bottles of beer on the wall.\n\n24 bottles of beer on the wall, 24 bottles of beer.\nTake one down and pass it around, 23 bottles of beer on the wall.\n\n23 bottles of beer on the wall, 23 bottles of beer.\nTake one down and pass it around, 22 bottles of beer on the wall.\n\n22 bottles of beer on the wall, 22 bottles of beer.\nTake one down and pass it around, 21 bottles of beer on the wall.\n\n21 bottles of beer on the wall, 21 bottles of beer.\nTake one down and pass it around, 20 bottles of beer on the wall.\n\n20 bottles of beer on the wall, 20 bottles of beer.\nTake one down and pass it around, 19 bottles of beer on the wall.\n\n19 bottles of beer on the wall, 19 bottles of beer.\nTake one down and pass it around, 18 bottles of beer on the wall.\n\n18 bottles of beer on the wall, 18 bottles of beer.\nTake one down and pass it around, 17 bottles of beer on the wall.\n\n17 bottles of beer on the wall, 17 bottles of beer.\nTake one down and pass it around, 16 bottles of beer on the wall.\n\n16 bottles of beer on the wall, 16 bottles of beer.\nTake one down and pass it around, 15 bottles of beer on the wall.\n\n15 bottles of beer on the wall, 15 bottles of beer.\nTake one down and pass it around, 14 bottles of beer on the wall.\n\n14 bottles of beer on the wall, 14 bottles of beer.\nTake one down and pass it around, 13 bottles of beer on the wall.\n\n13 bottles of beer on the wall, 13 bottles of beer.\nTake one down and pass it around, 12 bottles of beer on the wall.\n\n12 bottles of beer on the wall, 12 bottles of beer.\nTake one down and pass it around, 11 bottles of beer on the wall.\n\n11 bottles of beer on the wall, 11 bottles of beer.\nTake one down and pass it around, 10 bottles of beer on the wall.\n\n10 bottles of beer on the wall, 10 bottles of beer.\nTake one down and pass it around, 9 bottles of beer on the wall.\n\n9 bottles of beer on the wall, 9 bottles of beer.\nTake one down and pass it around, 8 bottles of beer on the wall.\n\n8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n\n6 bottles of beer on the wall, 6 bottles of beer.\nTake one down and pass it around, 5 bottles of beer on the wall.\n\n5 bottles of beer on the wall, 5 bottles of beer.\nTake one down and pass it around, 4 bottles of beer on the wall.\n\n4 bottles of beer on the wall, 4 bottles of beer.\nTake one down and pass it around, 3 bottles of beer on the wall.\n\n3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake one down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.";
|
40
|
+
NSString* expectedVerses = @"75 bottles of beer on the wall, 75 bottles of beer.\nTake one down and pass it around, 74 bottles of beer on the wall.\n\n74 bottles of beer on the wall, 74 bottles of beer.\nTake one down and pass it around, 73 bottles of beer on the wall.\n\n73 bottles of beer on the wall, 73 bottles of beer.\nTake one down and pass it around, 72 bottles of beer on the wall.\n\n72 bottles of beer on the wall, 72 bottles of beer.\nTake one down and pass it around, 71 bottles of beer on the wall.\n\n71 bottles of beer on the wall, 71 bottles of beer.\nTake one down and pass it around, 70 bottles of beer on the wall.\n\n70 bottles of beer on the wall, 70 bottles of beer.\nTake one down and pass it around, 69 bottles of beer on the wall.\n\n69 bottles of beer on the wall, 69 bottles of beer.\nTake one down and pass it around, 68 bottles of beer on the wall.\n\n68 bottles of beer on the wall, 68 bottles of beer.\nTake one down and pass it around, 67 bottles of beer on the wall.\n\n67 bottles of beer on the wall, 67 bottles of beer.\nTake one down and pass it around, 66 bottles of beer on the wall.\n\n66 bottles of beer on the wall, 66 bottles of beer.\nTake one down and pass it around, 65 bottles of beer on the wall.\n\n65 bottles of beer on the wall, 65 bottles of beer.\nTake one down and pass it around, 64 bottles of beer on the wall.\n\n64 bottles of beer on the wall, 64 bottles of beer.\nTake one down and pass it around, 63 bottles of beer on the wall.\n\n63 bottles of beer on the wall, 63 bottles of beer.\nTake one down and pass it around, 62 bottles of beer on the wall.\n\n62 bottles of beer on the wall, 62 bottles of beer.\nTake one down and pass it around, 61 bottles of beer on the wall.\n\n61 bottles of beer on the wall, 61 bottles of beer.\nTake one down and pass it around, 60 bottles of beer on the wall.\n\n60 bottles of beer on the wall, 60 bottles of beer.\nTake one down and pass it around, 59 bottles of beer on the wall.\n\n59 bottles of beer on the wall, 59 bottles of beer.\nTake one down and pass it around, 58 bottles of beer on the wall.\n\n58 bottles of beer on the wall, 58 bottles of beer.\nTake one down and pass it around, 57 bottles of beer on the wall.\n\n57 bottles of beer on the wall, 57 bottles of beer.\nTake one down and pass it around, 56 bottles of beer on the wall.\n\n56 bottles of beer on the wall, 56 bottles of beer.\nTake one down and pass it around, 55 bottles of beer on the wall.\n\n55 bottles of beer on the wall, 55 bottles of beer.\nTake one down and pass it around, 54 bottles of beer on the wall.\n\n54 bottles of beer on the wall, 54 bottles of beer.\nTake one down and pass it around, 53 bottles of beer on the wall.\n\n53 bottles of beer on the wall, 53 bottles of beer.\nTake one down and pass it around, 52 bottles of beer on the wall.\n\n52 bottles of beer on the wall, 52 bottles of beer.\nTake one down and pass it around, 51 bottles of beer on the wall.\n\n51 bottles of beer on the wall, 51 bottles of beer.\nTake one down and pass it around, 50 bottles of beer on the wall.\n\n50 bottles of beer on the wall, 50 bottles of beer.\nTake one down and pass it around, 49 bottles of beer on the wall.\n\n49 bottles of beer on the wall, 49 bottles of beer.\nTake one down and pass it around, 48 bottles of beer on the wall.\n\n48 bottles of beer on the wall, 48 bottles of beer.\nTake one down and pass it around, 47 bottles of beer on the wall.\n\n47 bottles of beer on the wall, 47 bottles of beer.\nTake one down and pass it around, 46 bottles of beer on the wall.\n\n46 bottles of beer on the wall, 46 bottles of beer.\nTake one down and pass it around, 45 bottles of beer on the wall.\n\n45 bottles of beer on the wall, 45 bottles of beer.\nTake one down and pass it around, 44 bottles of beer on the wall.\n\n44 bottles of beer on the wall, 44 bottles of beer.\nTake one down and pass it around, 43 bottles of beer on the wall.\n\n43 bottles of beer on the wall, 43 bottles of beer.\nTake one down and pass it around, 42 bottles of beer on the wall.\n\n42 bottles of beer on the wall, 42 bottles of beer.\nTake one down and pass it around, 41 bottles of beer on the wall.\n\n41 bottles of beer on the wall, 41 bottles of beer.\nTake one down and pass it around, 40 bottles of beer on the wall.\n\n40 bottles of beer on the wall, 40 bottles of beer.\nTake one down and pass it around, 39 bottles of beer on the wall.\n\n39 bottles of beer on the wall, 39 bottles of beer.\nTake one down and pass it around, 38 bottles of beer on the wall.\n\n38 bottles of beer on the wall, 38 bottles of beer.\nTake one down and pass it around, 37 bottles of beer on the wall.\n\n37 bottles of beer on the wall, 37 bottles of beer.\nTake one down and pass it around, 36 bottles of beer on the wall.\n\n36 bottles of beer on the wall, 36 bottles of beer.\nTake one down and pass it around, 35 bottles of beer on the wall.\n\n35 bottles of beer on the wall, 35 bottles of beer.\nTake one down and pass it around, 34 bottles of beer on the wall.\n\n34 bottles of beer on the wall, 34 bottles of beer.\nTake one down and pass it around, 33 bottles of beer on the wall.\n\n33 bottles of beer on the wall, 33 bottles of beer.\nTake one down and pass it around, 32 bottles of beer on the wall.\n\n32 bottles of beer on the wall, 32 bottles of beer.\nTake one down and pass it around, 31 bottles of beer on the wall.\n\n31 bottles of beer on the wall, 31 bottles of beer.\nTake one down and pass it around, 30 bottles of beer on the wall.\n\n30 bottles of beer on the wall, 30 bottles of beer.\nTake one down and pass it around, 29 bottles of beer on the wall.\n\n29 bottles of beer on the wall, 29 bottles of beer.\nTake one down and pass it around, 28 bottles of beer on the wall.\n\n28 bottles of beer on the wall, 28 bottles of beer.\nTake one down and pass it around, 27 bottles of beer on the wall.\n\n27 bottles of beer on the wall, 27 bottles of beer.\nTake one down and pass it around, 26 bottles of beer on the wall.\n\n26 bottles of beer on the wall, 26 bottles of beer.\nTake one down and pass it around, 25 bottles of beer on the wall.\n\n25 bottles of beer on the wall, 25 bottles of beer.\nTake one down and pass it around, 24 bottles of beer on the wall.\n\n24 bottles of beer on the wall, 24 bottles of beer.\nTake one down and pass it around, 23 bottles of beer on the wall.\n\n23 bottles of beer on the wall, 23 bottles of beer.\nTake one down and pass it around, 22 bottles of beer on the wall.\n\n22 bottles of beer on the wall, 22 bottles of beer.\nTake one down and pass it around, 21 bottles of beer on the wall.\n\n21 bottles of beer on the wall, 21 bottles of beer.\nTake one down and pass it around, 20 bottles of beer on the wall.\n\n20 bottles of beer on the wall, 20 bottles of beer.\nTake one down and pass it around, 19 bottles of beer on the wall.\n\n19 bottles of beer on the wall, 19 bottles of beer.\nTake one down and pass it around, 18 bottles of beer on the wall.\n\n18 bottles of beer on the wall, 18 bottles of beer.\nTake one down and pass it around, 17 bottles of beer on the wall.\n\n17 bottles of beer on the wall, 17 bottles of beer.\nTake one down and pass it around, 16 bottles of beer on the wall.\n\n16 bottles of beer on the wall, 16 bottles of beer.\nTake one down and pass it around, 15 bottles of beer on the wall.\n\n15 bottles of beer on the wall, 15 bottles of beer.\nTake one down and pass it around, 14 bottles of beer on the wall.\n\n14 bottles of beer on the wall, 14 bottles of beer.\nTake one down and pass it around, 13 bottles of beer on the wall.\n\n13 bottles of beer on the wall, 13 bottles of beer.\nTake one down and pass it around, 12 bottles of beer on the wall.\n\n12 bottles of beer on the wall, 12 bottles of beer.\nTake one down and pass it around, 11 bottles of beer on the wall.\n\n11 bottles of beer on the wall, 11 bottles of beer.\nTake one down and pass it around, 10 bottles of beer on the wall.\n\n10 bottles of beer on the wall, 10 bottles of beer.\nTake one down and pass it around, 9 bottles of beer on the wall.\n\n9 bottles of beer on the wall, 9 bottles of beer.\nTake one down and pass it around, 8 bottles of beer on the wall.\n\n8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n\n6 bottles of beer on the wall, 6 bottles of beer.\nTake one down and pass it around, 5 bottles of beer on the wall.\n\n5 bottles of beer on the wall, 5 bottles of beer.\nTake one down and pass it around, 4 bottles of beer on the wall.\n\n4 bottles of beer on the wall, 4 bottles of beer.\nTake one down and pass it around, 3 bottles of beer on the wall.\n\n3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake one down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall."; //!OCLint
|
41
41
|
XCTAssertEqualObjects(expectedVerses, [songExample singBeerSong]);
|
42
42
|
}
|
43
43
|
|
44
44
|
-(void)testAllVersesOfBeerSong{
|
45
45
|
|
46
46
|
BeerSongExample *songExample = [[BeerSongExample alloc]initWithNumberOfBeerBottles:99];
|
47
|
-
NSString* expectedVerses = @"99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n\n98 bottles of beer on the wall, 98 bottles of beer.\nTake one down and pass it around, 97 bottles of beer on the wall.\n\n97 bottles of beer on the wall, 97 bottles of beer.\nTake one down and pass it around, 96 bottles of beer on the wall.\n\n96 bottles of beer on the wall, 96 bottles of beer.\nTake one down and pass it around, 95 bottles of beer on the wall.\n\n95 bottles of beer on the wall, 95 bottles of beer.\nTake one down and pass it around, 94 bottles of beer on the wall.\n\n94 bottles of beer on the wall, 94 bottles of beer.\nTake one down and pass it around, 93 bottles of beer on the wall.\n\n93 bottles of beer on the wall, 93 bottles of beer.\nTake one down and pass it around, 92 bottles of beer on the wall.\n\n92 bottles of beer on the wall, 92 bottles of beer.\nTake one down and pass it around, 91 bottles of beer on the wall.\n\n91 bottles of beer on the wall, 91 bottles of beer.\nTake one down and pass it around, 90 bottles of beer on the wall.\n\n90 bottles of beer on the wall, 90 bottles of beer.\nTake one down and pass it around, 89 bottles of beer on the wall.\n\n89 bottles of beer on the wall, 89 bottles of beer.\nTake one down and pass it around, 88 bottles of beer on the wall.\n\n88 bottles of beer on the wall, 88 bottles of beer.\nTake one down and pass it around, 87 bottles of beer on the wall.\n\n87 bottles of beer on the wall, 87 bottles of beer.\nTake one down and pass it around, 86 bottles of beer on the wall.\n\n86 bottles of beer on the wall, 86 bottles of beer.\nTake one down and pass it around, 85 bottles of beer on the wall.\n\n85 bottles of beer on the wall, 85 bottles of beer.\nTake one down and pass it around, 84 bottles of beer on the wall.\n\n84 bottles of beer on the wall, 84 bottles of beer.\nTake one down and pass it around, 83 bottles of beer on the wall.\n\n83 bottles of beer on the wall, 83 bottles of beer.\nTake one down and pass it around, 82 bottles of beer on the wall.\n\n82 bottles of beer on the wall, 82 bottles of beer.\nTake one down and pass it around, 81 bottles of beer on the wall.\n\n81 bottles of beer on the wall, 81 bottles of beer.\nTake one down and pass it around, 80 bottles of beer on the wall.\n\n80 bottles of beer on the wall, 80 bottles of beer.\nTake one down and pass it around, 79 bottles of beer on the wall.\n\n79 bottles of beer on the wall, 79 bottles of beer.\nTake one down and pass it around, 78 bottles of beer on the wall.\n\n78 bottles of beer on the wall, 78 bottles of beer.\nTake one down and pass it around, 77 bottles of beer on the wall.\n\n77 bottles of beer on the wall, 77 bottles of beer.\nTake one down and pass it around, 76 bottles of beer on the wall.\n\n76 bottles of beer on the wall, 76 bottles of beer.\nTake one down and pass it around, 75 bottles of beer on the wall.\n\n75 bottles of beer on the wall, 75 bottles of beer.\nTake one down and pass it around, 74 bottles of beer on the wall.\n\n74 bottles of beer on the wall, 74 bottles of beer.\nTake one down and pass it around, 73 bottles of beer on the wall.\n\n73 bottles of beer on the wall, 73 bottles of beer.\nTake one down and pass it around, 72 bottles of beer on the wall.\n\n72 bottles of beer on the wall, 72 bottles of beer.\nTake one down and pass it around, 71 bottles of beer on the wall.\n\n71 bottles of beer on the wall, 71 bottles of beer.\nTake one down and pass it around, 70 bottles of beer on the wall.\n\n70 bottles of beer on the wall, 70 bottles of beer.\nTake one down and pass it around, 69 bottles of beer on the wall.\n\n69 bottles of beer on the wall, 69 bottles of beer.\nTake one down and pass it around, 68 bottles of beer on the wall.\n\n68 bottles of beer on the wall, 68 bottles of beer.\nTake one down and pass it around, 67 bottles of beer on the wall.\n\n67 bottles of beer on the wall, 67 bottles of beer.\nTake one down and pass it around, 66 bottles of beer on the wall.\n\n66 bottles of beer on the wall, 66 bottles of beer.\nTake one down and pass it around, 65 bottles of beer on the wall.\n\n65 bottles of beer on the wall, 65 bottles of beer.\nTake one down and pass it around, 64 bottles of beer on the wall.\n\n64 bottles of beer on the wall, 64 bottles of beer.\nTake one down and pass it around, 63 bottles of beer on the wall.\n\n63 bottles of beer on the wall, 63 bottles of beer.\nTake one down and pass it around, 62 bottles of beer on the wall.\n\n62 bottles of beer on the wall, 62 bottles of beer.\nTake one down and pass it around, 61 bottles of beer on the wall.\n\n61 bottles of beer on the wall, 61 bottles of beer.\nTake one down and pass it around, 60 bottles of beer on the wall.\n\n60 bottles of beer on the wall, 60 bottles of beer.\nTake one down and pass it around, 59 bottles of beer on the wall.\n\n59 bottles of beer on the wall, 59 bottles of beer.\nTake one down and pass it around, 58 bottles of beer on the wall.\n\n58 bottles of beer on the wall, 58 bottles of beer.\nTake one down and pass it around, 57 bottles of beer on the wall.\n\n57 bottles of beer on the wall, 57 bottles of beer.\nTake one down and pass it around, 56 bottles of beer on the wall.\n\n56 bottles of beer on the wall, 56 bottles of beer.\nTake one down and pass it around, 55 bottles of beer on the wall.\n\n55 bottles of beer on the wall, 55 bottles of beer.\nTake one down and pass it around, 54 bottles of beer on the wall.\n\n54 bottles of beer on the wall, 54 bottles of beer.\nTake one down and pass it around, 53 bottles of beer on the wall.\n\n53 bottles of beer on the wall, 53 bottles of beer.\nTake one down and pass it around, 52 bottles of beer on the wall.\n\n52 bottles of beer on the wall, 52 bottles of beer.\nTake one down and pass it around, 51 bottles of beer on the wall.\n\n51 bottles of beer on the wall, 51 bottles of beer.\nTake one down and pass it around, 50 bottles of beer on the wall.\n\n50 bottles of beer on the wall, 50 bottles of beer.\nTake one down and pass it around, 49 bottles of beer on the wall.\n\n49 bottles of beer on the wall, 49 bottles of beer.\nTake one down and pass it around, 48 bottles of beer on the wall.\n\n48 bottles of beer on the wall, 48 bottles of beer.\nTake one down and pass it around, 47 bottles of beer on the wall.\n\n47 bottles of beer on the wall, 47 bottles of beer.\nTake one down and pass it around, 46 bottles of beer on the wall.\n\n46 bottles of beer on the wall, 46 bottles of beer.\nTake one down and pass it around, 45 bottles of beer on the wall.\n\n45 bottles of beer on the wall, 45 bottles of beer.\nTake one down and pass it around, 44 bottles of beer on the wall.\n\n44 bottles of beer on the wall, 44 bottles of beer.\nTake one down and pass it around, 43 bottles of beer on the wall.\n\n43 bottles of beer on the wall, 43 bottles of beer.\nTake one down and pass it around, 42 bottles of beer on the wall.\n\n42 bottles of beer on the wall, 42 bottles of beer.\nTake one down and pass it around, 41 bottles of beer on the wall.\n\n41 bottles of beer on the wall, 41 bottles of beer.\nTake one down and pass it around, 40 bottles of beer on the wall.\n\n40 bottles of beer on the wall, 40 bottles of beer.\nTake one down and pass it around, 39 bottles of beer on the wall.\n\n39 bottles of beer on the wall, 39 bottles of beer.\nTake one down and pass it around, 38 bottles of beer on the wall.\n\n38 bottles of beer on the wall, 38 bottles of beer.\nTake one down and pass it around, 37 bottles of beer on the wall.\n\n37 bottles of beer on the wall, 37 bottles of beer.\nTake one down and pass it around, 36 bottles of beer on the wall.\n\n36 bottles of beer on the wall, 36 bottles of beer.\nTake one down and pass it around, 35 bottles of beer on the wall.\n\n35 bottles of beer on the wall, 35 bottles of beer.\nTake one down and pass it around, 34 bottles of beer on the wall.\n\n34 bottles of beer on the wall, 34 bottles of beer.\nTake one down and pass it around, 33 bottles of beer on the wall.\n\n33 bottles of beer on the wall, 33 bottles of beer.\nTake one down and pass it around, 32 bottles of beer on the wall.\n\n32 bottles of beer on the wall, 32 bottles of beer.\nTake one down and pass it around, 31 bottles of beer on the wall.\n\n31 bottles of beer on the wall, 31 bottles of beer.\nTake one down and pass it around, 30 bottles of beer on the wall.\n\n30 bottles of beer on the wall, 30 bottles of beer.\nTake one down and pass it around, 29 bottles of beer on the wall.\n\n29 bottles of beer on the wall, 29 bottles of beer.\nTake one down and pass it around, 28 bottles of beer on the wall.\n\n28 bottles of beer on the wall, 28 bottles of beer.\nTake one down and pass it around, 27 bottles of beer on the wall.\n\n27 bottles of beer on the wall, 27 bottles of beer.\nTake one down and pass it around, 26 bottles of beer on the wall.\n\n26 bottles of beer on the wall, 26 bottles of beer.\nTake one down and pass it around, 25 bottles of beer on the wall.\n\n25 bottles of beer on the wall, 25 bottles of beer.\nTake one down and pass it around, 24 bottles of beer on the wall.\n\n24 bottles of beer on the wall, 24 bottles of beer.\nTake one down and pass it around, 23 bottles of beer on the wall.\n\n23 bottles of beer on the wall, 23 bottles of beer.\nTake one down and pass it around, 22 bottles of beer on the wall.\n\n22 bottles of beer on the wall, 22 bottles of beer.\nTake one down and pass it around, 21 bottles of beer on the wall.\n\n21 bottles of beer on the wall, 21 bottles of beer.\nTake one down and pass it around, 20 bottles of beer on the wall.\n\n20 bottles of beer on the wall, 20 bottles of beer.\nTake one down and pass it around, 19 bottles of beer on the wall.\n\n19 bottles of beer on the wall, 19 bottles of beer.\nTake one down and pass it around, 18 bottles of beer on the wall.\n\n18 bottles of beer on the wall, 18 bottles of beer.\nTake one down and pass it around, 17 bottles of beer on the wall.\n\n17 bottles of beer on the wall, 17 bottles of beer.\nTake one down and pass it around, 16 bottles of beer on the wall.\n\n16 bottles of beer on the wall, 16 bottles of beer.\nTake one down and pass it around, 15 bottles of beer on the wall.\n\n15 bottles of beer on the wall, 15 bottles of beer.\nTake one down and pass it around, 14 bottles of beer on the wall.\n\n14 bottles of beer on the wall, 14 bottles of beer.\nTake one down and pass it around, 13 bottles of beer on the wall.\n\n13 bottles of beer on the wall, 13 bottles of beer.\nTake one down and pass it around, 12 bottles of beer on the wall.\n\n12 bottles of beer on the wall, 12 bottles of beer.\nTake one down and pass it around, 11 bottles of beer on the wall.\n\n11 bottles of beer on the wall, 11 bottles of beer.\nTake one down and pass it around, 10 bottles of beer on the wall.\n\n10 bottles of beer on the wall, 10 bottles of beer.\nTake one down and pass it around, 9 bottles of beer on the wall.\n\n9 bottles of beer on the wall, 9 bottles of beer.\nTake one down and pass it around, 8 bottles of beer on the wall.\n\n8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n\n6 bottles of beer on the wall, 6 bottles of beer.\nTake one down and pass it around, 5 bottles of beer on the wall.\n\n5 bottles of beer on the wall, 5 bottles of beer.\nTake one down and pass it around, 4 bottles of beer on the wall.\n\n4 bottles of beer on the wall, 4 bottles of beer.\nTake one down and pass it around, 3 bottles of beer on the wall.\n\n3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake one down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.";
|
47
|
+
NSString* expectedVerses = @"99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n\n98 bottles of beer on the wall, 98 bottles of beer.\nTake one down and pass it around, 97 bottles of beer on the wall.\n\n97 bottles of beer on the wall, 97 bottles of beer.\nTake one down and pass it around, 96 bottles of beer on the wall.\n\n96 bottles of beer on the wall, 96 bottles of beer.\nTake one down and pass it around, 95 bottles of beer on the wall.\n\n95 bottles of beer on the wall, 95 bottles of beer.\nTake one down and pass it around, 94 bottles of beer on the wall.\n\n94 bottles of beer on the wall, 94 bottles of beer.\nTake one down and pass it around, 93 bottles of beer on the wall.\n\n93 bottles of beer on the wall, 93 bottles of beer.\nTake one down and pass it around, 92 bottles of beer on the wall.\n\n92 bottles of beer on the wall, 92 bottles of beer.\nTake one down and pass it around, 91 bottles of beer on the wall.\n\n91 bottles of beer on the wall, 91 bottles of beer.\nTake one down and pass it around, 90 bottles of beer on the wall.\n\n90 bottles of beer on the wall, 90 bottles of beer.\nTake one down and pass it around, 89 bottles of beer on the wall.\n\n89 bottles of beer on the wall, 89 bottles of beer.\nTake one down and pass it around, 88 bottles of beer on the wall.\n\n88 bottles of beer on the wall, 88 bottles of beer.\nTake one down and pass it around, 87 bottles of beer on the wall.\n\n87 bottles of beer on the wall, 87 bottles of beer.\nTake one down and pass it around, 86 bottles of beer on the wall.\n\n86 bottles of beer on the wall, 86 bottles of beer.\nTake one down and pass it around, 85 bottles of beer on the wall.\n\n85 bottles of beer on the wall, 85 bottles of beer.\nTake one down and pass it around, 84 bottles of beer on the wall.\n\n84 bottles of beer on the wall, 84 bottles of beer.\nTake one down and pass it around, 83 bottles of beer on the wall.\n\n83 bottles of beer on the wall, 83 bottles of beer.\nTake one down and pass it around, 82 bottles of beer on the wall.\n\n82 bottles of beer on the wall, 82 bottles of beer.\nTake one down and pass it around, 81 bottles of beer on the wall.\n\n81 bottles of beer on the wall, 81 bottles of beer.\nTake one down and pass it around, 80 bottles of beer on the wall.\n\n80 bottles of beer on the wall, 80 bottles of beer.\nTake one down and pass it around, 79 bottles of beer on the wall.\n\n79 bottles of beer on the wall, 79 bottles of beer.\nTake one down and pass it around, 78 bottles of beer on the wall.\n\n78 bottles of beer on the wall, 78 bottles of beer.\nTake one down and pass it around, 77 bottles of beer on the wall.\n\n77 bottles of beer on the wall, 77 bottles of beer.\nTake one down and pass it around, 76 bottles of beer on the wall.\n\n76 bottles of beer on the wall, 76 bottles of beer.\nTake one down and pass it around, 75 bottles of beer on the wall.\n\n75 bottles of beer on the wall, 75 bottles of beer.\nTake one down and pass it around, 74 bottles of beer on the wall.\n\n74 bottles of beer on the wall, 74 bottles of beer.\nTake one down and pass it around, 73 bottles of beer on the wall.\n\n73 bottles of beer on the wall, 73 bottles of beer.\nTake one down and pass it around, 72 bottles of beer on the wall.\n\n72 bottles of beer on the wall, 72 bottles of beer.\nTake one down and pass it around, 71 bottles of beer on the wall.\n\n71 bottles of beer on the wall, 71 bottles of beer.\nTake one down and pass it around, 70 bottles of beer on the wall.\n\n70 bottles of beer on the wall, 70 bottles of beer.\nTake one down and pass it around, 69 bottles of beer on the wall.\n\n69 bottles of beer on the wall, 69 bottles of beer.\nTake one down and pass it around, 68 bottles of beer on the wall.\n\n68 bottles of beer on the wall, 68 bottles of beer.\nTake one down and pass it around, 67 bottles of beer on the wall.\n\n67 bottles of beer on the wall, 67 bottles of beer.\nTake one down and pass it around, 66 bottles of beer on the wall.\n\n66 bottles of beer on the wall, 66 bottles of beer.\nTake one down and pass it around, 65 bottles of beer on the wall.\n\n65 bottles of beer on the wall, 65 bottles of beer.\nTake one down and pass it around, 64 bottles of beer on the wall.\n\n64 bottles of beer on the wall, 64 bottles of beer.\nTake one down and pass it around, 63 bottles of beer on the wall.\n\n63 bottles of beer on the wall, 63 bottles of beer.\nTake one down and pass it around, 62 bottles of beer on the wall.\n\n62 bottles of beer on the wall, 62 bottles of beer.\nTake one down and pass it around, 61 bottles of beer on the wall.\n\n61 bottles of beer on the wall, 61 bottles of beer.\nTake one down and pass it around, 60 bottles of beer on the wall.\n\n60 bottles of beer on the wall, 60 bottles of beer.\nTake one down and pass it around, 59 bottles of beer on the wall.\n\n59 bottles of beer on the wall, 59 bottles of beer.\nTake one down and pass it around, 58 bottles of beer on the wall.\n\n58 bottles of beer on the wall, 58 bottles of beer.\nTake one down and pass it around, 57 bottles of beer on the wall.\n\n57 bottles of beer on the wall, 57 bottles of beer.\nTake one down and pass it around, 56 bottles of beer on the wall.\n\n56 bottles of beer on the wall, 56 bottles of beer.\nTake one down and pass it around, 55 bottles of beer on the wall.\n\n55 bottles of beer on the wall, 55 bottles of beer.\nTake one down and pass it around, 54 bottles of beer on the wall.\n\n54 bottles of beer on the wall, 54 bottles of beer.\nTake one down and pass it around, 53 bottles of beer on the wall.\n\n53 bottles of beer on the wall, 53 bottles of beer.\nTake one down and pass it around, 52 bottles of beer on the wall.\n\n52 bottles of beer on the wall, 52 bottles of beer.\nTake one down and pass it around, 51 bottles of beer on the wall.\n\n51 bottles of beer on the wall, 51 bottles of beer.\nTake one down and pass it around, 50 bottles of beer on the wall.\n\n50 bottles of beer on the wall, 50 bottles of beer.\nTake one down and pass it around, 49 bottles of beer on the wall.\n\n49 bottles of beer on the wall, 49 bottles of beer.\nTake one down and pass it around, 48 bottles of beer on the wall.\n\n48 bottles of beer on the wall, 48 bottles of beer.\nTake one down and pass it around, 47 bottles of beer on the wall.\n\n47 bottles of beer on the wall, 47 bottles of beer.\nTake one down and pass it around, 46 bottles of beer on the wall.\n\n46 bottles of beer on the wall, 46 bottles of beer.\nTake one down and pass it around, 45 bottles of beer on the wall.\n\n45 bottles of beer on the wall, 45 bottles of beer.\nTake one down and pass it around, 44 bottles of beer on the wall.\n\n44 bottles of beer on the wall, 44 bottles of beer.\nTake one down and pass it around, 43 bottles of beer on the wall.\n\n43 bottles of beer on the wall, 43 bottles of beer.\nTake one down and pass it around, 42 bottles of beer on the wall.\n\n42 bottles of beer on the wall, 42 bottles of beer.\nTake one down and pass it around, 41 bottles of beer on the wall.\n\n41 bottles of beer on the wall, 41 bottles of beer.\nTake one down and pass it around, 40 bottles of beer on the wall.\n\n40 bottles of beer on the wall, 40 bottles of beer.\nTake one down and pass it around, 39 bottles of beer on the wall.\n\n39 bottles of beer on the wall, 39 bottles of beer.\nTake one down and pass it around, 38 bottles of beer on the wall.\n\n38 bottles of beer on the wall, 38 bottles of beer.\nTake one down and pass it around, 37 bottles of beer on the wall.\n\n37 bottles of beer on the wall, 37 bottles of beer.\nTake one down and pass it around, 36 bottles of beer on the wall.\n\n36 bottles of beer on the wall, 36 bottles of beer.\nTake one down and pass it around, 35 bottles of beer on the wall.\n\n35 bottles of beer on the wall, 35 bottles of beer.\nTake one down and pass it around, 34 bottles of beer on the wall.\n\n34 bottles of beer on the wall, 34 bottles of beer.\nTake one down and pass it around, 33 bottles of beer on the wall.\n\n33 bottles of beer on the wall, 33 bottles of beer.\nTake one down and pass it around, 32 bottles of beer on the wall.\n\n32 bottles of beer on the wall, 32 bottles of beer.\nTake one down and pass it around, 31 bottles of beer on the wall.\n\n31 bottles of beer on the wall, 31 bottles of beer.\nTake one down and pass it around, 30 bottles of beer on the wall.\n\n30 bottles of beer on the wall, 30 bottles of beer.\nTake one down and pass it around, 29 bottles of beer on the wall.\n\n29 bottles of beer on the wall, 29 bottles of beer.\nTake one down and pass it around, 28 bottles of beer on the wall.\n\n28 bottles of beer on the wall, 28 bottles of beer.\nTake one down and pass it around, 27 bottles of beer on the wall.\n\n27 bottles of beer on the wall, 27 bottles of beer.\nTake one down and pass it around, 26 bottles of beer on the wall.\n\n26 bottles of beer on the wall, 26 bottles of beer.\nTake one down and pass it around, 25 bottles of beer on the wall.\n\n25 bottles of beer on the wall, 25 bottles of beer.\nTake one down and pass it around, 24 bottles of beer on the wall.\n\n24 bottles of beer on the wall, 24 bottles of beer.\nTake one down and pass it around, 23 bottles of beer on the wall.\n\n23 bottles of beer on the wall, 23 bottles of beer.\nTake one down and pass it around, 22 bottles of beer on the wall.\n\n22 bottles of beer on the wall, 22 bottles of beer.\nTake one down and pass it around, 21 bottles of beer on the wall.\n\n21 bottles of beer on the wall, 21 bottles of beer.\nTake one down and pass it around, 20 bottles of beer on the wall.\n\n20 bottles of beer on the wall, 20 bottles of beer.\nTake one down and pass it around, 19 bottles of beer on the wall.\n\n19 bottles of beer on the wall, 19 bottles of beer.\nTake one down and pass it around, 18 bottles of beer on the wall.\n\n18 bottles of beer on the wall, 18 bottles of beer.\nTake one down and pass it around, 17 bottles of beer on the wall.\n\n17 bottles of beer on the wall, 17 bottles of beer.\nTake one down and pass it around, 16 bottles of beer on the wall.\n\n16 bottles of beer on the wall, 16 bottles of beer.\nTake one down and pass it around, 15 bottles of beer on the wall.\n\n15 bottles of beer on the wall, 15 bottles of beer.\nTake one down and pass it around, 14 bottles of beer on the wall.\n\n14 bottles of beer on the wall, 14 bottles of beer.\nTake one down and pass it around, 13 bottles of beer on the wall.\n\n13 bottles of beer on the wall, 13 bottles of beer.\nTake one down and pass it around, 12 bottles of beer on the wall.\n\n12 bottles of beer on the wall, 12 bottles of beer.\nTake one down and pass it around, 11 bottles of beer on the wall.\n\n11 bottles of beer on the wall, 11 bottles of beer.\nTake one down and pass it around, 10 bottles of beer on the wall.\n\n10 bottles of beer on the wall, 10 bottles of beer.\nTake one down and pass it around, 9 bottles of beer on the wall.\n\n9 bottles of beer on the wall, 9 bottles of beer.\nTake one down and pass it around, 8 bottles of beer on the wall.\n\n8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n\n6 bottles of beer on the wall, 6 bottles of beer.\nTake one down and pass it around, 5 bottles of beer on the wall.\n\n5 bottles of beer on the wall, 5 bottles of beer.\nTake one down and pass it around, 4 bottles of beer on the wall.\n\n4 bottles of beer on the wall, 4 bottles of beer.\nTake one down and pass it around, 3 bottles of beer on the wall.\n\n3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake one down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall."; //!OCLint
|
48
48
|
XCTAssertEqualObjects(expectedVerses, [songExample singBeerSong]);
|
49
49
|
}
|
50
50
|
|
@@ -32,7 +32,7 @@
|
|
32
32
|
}
|
33
33
|
|
34
34
|
return [binary searchFor:number];
|
35
|
-
} else {
|
35
|
+
} else { //!OCLint
|
36
36
|
NSUInteger length = self.list.count - middleIndex;
|
37
37
|
NSArray *sublist = [self.list subarrayWithRange:NSMakeRange(middleIndex, length)];
|
38
38
|
if ([sublist isEqualToArray:self.list]) {
|
@@ -4,41 +4,28 @@ static NSNull *nullValue;
|
|
4
4
|
|
5
5
|
@implementation FlattenArrayExample
|
6
6
|
|
7
|
-
+ (NSArray*)flattenArray:(NSArray *)list{
|
8
|
-
|
7
|
+
+ (NSArray *)flattenArray:(NSArray *)list{
|
9
8
|
resultArray = [NSMutableArray array];
|
10
9
|
nullValue = [NSNull null];
|
11
|
-
|
12
|
-
|
13
|
-
if([list[i] isKindOfClass:[NSArray class]]){
|
14
|
-
|
10
|
+
|
11
|
+
for (int i = 0; i < list.count; i++) {
|
12
|
+
if ([list[i] isKindOfClass:[NSArray class]]) {
|
15
13
|
[FlattenArrayExample extractValuesFromArray:list[i]];
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
if(list[i] != nullValue){
|
20
|
-
|
21
|
-
[resultArray addObject:list[i]];
|
22
|
-
}
|
14
|
+
} else if (list[i] != nullValue) {
|
15
|
+
[resultArray addObject:list[i]];
|
23
16
|
}
|
24
17
|
}
|
18
|
+
|
25
19
|
return resultArray;
|
26
20
|
}
|
27
21
|
|
28
22
|
|
29
|
-
+(void)extractValuesFromArray:(NSArray*)array{
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
if([array[i] isKindOfClass:[NSArray class]]){
|
34
|
-
|
23
|
+
+ (void)extractValuesFromArray:(NSArray*)array{
|
24
|
+
for (int i = 0; i < array.count; i++) {
|
25
|
+
if ([array[i] isKindOfClass:[NSArray class]]) {
|
35
26
|
[FlattenArrayExample extractValuesFromArray:array[i]];
|
36
|
-
}else{
|
37
|
-
|
38
|
-
if(array[i] != nullValue){
|
39
|
-
|
40
|
-
[resultArray addObject:array[i]];
|
41
|
-
}
|
27
|
+
} else if (array[i] != nullValue) {
|
28
|
+
[resultArray addObject:array[i]];
|
42
29
|
}
|
43
30
|
}
|
44
31
|
|
@@ -10,101 +10,53 @@
|
|
10
10
|
|
11
11
|
@end
|
12
12
|
|
13
|
+
static NSNull *nullValue;
|
14
|
+
|
13
15
|
@implementation FlattenArrayTest
|
14
16
|
|
17
|
+
- (void)setUp {
|
18
|
+
nullValue = [NSNull null];
|
19
|
+
}
|
20
|
+
|
15
21
|
- (void)testFlattenArrayWithJustIntegers {
|
16
|
-
|
17
|
-
NSArray *
|
18
|
-
|
19
|
-
NSArray *expected = [NSArray arrayWithObjects:[NSNumber numberWithInt:1],[NSNumber numberWithInt:2],[NSNumber numberWithInt:3],[NSNumber numberWithInt:4],[NSNumber numberWithInt:5],[NSNumber numberWithInt:6],[NSNumber numberWithInt:7],[NSNumber numberWithInt:8], nil];
|
20
|
-
XCTAssertTrue([expected isEqualToArray:[FlattenArrayExample flattenArray:inputArray]]);
|
21
|
-
|
22
|
-
|
22
|
+
NSArray *inputArray = @[@1, @[@2, @3, @4, @5, @6, @7], @8];
|
23
|
+
NSArray *expected = @[@1, @2, @3, @4, @5, @6, @7, @8];
|
24
|
+
XCTAssertEqualObjects(expected, [FlattenArrayExample flattenArray:inputArray]);
|
23
25
|
}
|
24
26
|
|
25
|
-
-(void)testFiveLevelNesting{
|
26
|
-
|
27
|
-
NSArray *
|
28
|
-
|
29
|
-
NSArray *innerArray3 = [NSArray arrayWithObject:innerArray4];
|
30
|
-
NSArray *innerArray2 = [NSArray arrayWithObjects:[NSNumber numberWithInt:2],[NSNumber numberWithInt:3], nil];
|
31
|
-
NSArray *innerArray1 = [NSArray arrayWithObjects:innerArray2,[NSNumber numberWithInt:8],[NSNumber numberWithInt:100],[NSNumber numberWithInt:4],innerArray3, nil];
|
32
|
-
NSArray *inputArray = [NSArray arrayWithObjects:[NSNumber numberWithInt:0],[NSNumber numberWithInt:2],innerArray1,[NSNumber numberWithInt:-2], nil];
|
33
|
-
|
34
|
-
NSArray *expected = [NSArray arrayWithObjects:[NSNumber numberWithInt:0],[NSNumber numberWithInt:2],[NSNumber numberWithInt:2],[NSNumber numberWithInt:3],[NSNumber numberWithInt:8],[NSNumber numberWithInt:100],[NSNumber numberWithInt:4],[NSNumber numberWithInt:50],[NSNumber numberWithInt:-2], nil];
|
35
|
-
XCTAssertTrue([expected isEqualToArray:[FlattenArrayExample flattenArray:inputArray]]);
|
27
|
+
- (void)testFiveLevelNesting {
|
28
|
+
NSArray *inputArray = @[@0, @2, @[@[@2, @3], @8, @100, @4, @[@[@50]]], @-2];
|
29
|
+
NSArray *expected = @[@0, @2, @2, @3, @8, @100, @4, @50, @-2];
|
30
|
+
XCTAssertEqualObjects(expected, [FlattenArrayExample flattenArray:inputArray]);
|
36
31
|
}
|
37
32
|
|
38
|
-
-(void)testSixLevelNesting{
|
39
|
-
|
40
|
-
NSArray *
|
41
|
-
|
42
|
-
NSArray *innerArray4 = [NSArray arrayWithObjects:[NSNumber numberWithInt:4],innerArray5, nil];
|
43
|
-
NSArray *innerArray3 = [NSArray arrayWithObject:[NSNumber numberWithInt:3]];
|
44
|
-
NSArray *innerArray2 = [NSArray arrayWithObject:innerArray3];
|
45
|
-
NSArray *innerArray1 = [NSArray arrayWithObjects:[NSNumber numberWithInt:2],innerArray2,innerArray4,[NSNumber numberWithInt:6],[NSNumber numberWithInt:7], nil];
|
46
|
-
NSArray *inputArray = [NSArray arrayWithObjects:[NSNumber numberWithInt:1],innerArray1,[NSNumber numberWithInt:8], nil];
|
47
|
-
NSArray *expected = [NSArray arrayWithObjects:[NSNumber numberWithInt:1],[NSNumber numberWithInt:2],[NSNumber numberWithInt:3],[NSNumber numberWithInt:4],[NSNumber numberWithInt:5],[NSNumber numberWithInt:6],[NSNumber numberWithInt:7],[NSNumber numberWithInt:8], nil];
|
48
|
-
XCTAssertTrue([expected isEqualToArray:[FlattenArrayExample flattenArray:inputArray]]);
|
33
|
+
- (void)testSixLevelNesting {
|
34
|
+
NSArray *inputArray = @[@1, @[@2, @[@[@3]], @[@4, @[@[@5]]], @6, @7], @8];
|
35
|
+
NSArray *expected = @[@1, @2, @3, @4, @5, @6, @7, @8];
|
36
|
+
XCTAssertEqualObjects(expected, [FlattenArrayExample flattenArray:inputArray]);
|
49
37
|
}
|
50
38
|
|
51
|
-
-(void)testSixLevelNestingWithNullValues{
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
NSArray *innerArray5 = [NSArray arrayWithObject:innerArray6];
|
56
|
-
NSArray *innerArray4 = [NSArray arrayWithObject:[NSNumber numberWithInt:100]];
|
57
|
-
NSArray *innerArray3 = [NSArray arrayWithObject:innerArray4];
|
58
|
-
NSArray *innerArray2 = [NSArray arrayWithObjects:[NSNumber numberWithInt:2],[NSNumber numberWithInt:3], nil];
|
59
|
-
NSArray *innerArray1 = [NSArray arrayWithObjects:innerArray2,[NSNumber numberWithInt:8],innerArray3,nullValue,innerArray5, nil];
|
60
|
-
NSArray *inputArray = [NSArray arrayWithObjects:[NSNumber numberWithInt:0],[NSNumber numberWithInt:2],innerArray1,[NSNumber numberWithInt:-2], nil];
|
61
|
-
NSArray *expected = [NSArray arrayWithObjects:[NSNumber numberWithInt:0],[NSNumber numberWithInt:2],[NSNumber numberWithInt:2],[NSNumber numberWithInt:3],[NSNumber numberWithInt:8],[NSNumber numberWithInt:100],[NSNumber numberWithInt:-2], nil];
|
62
|
-
XCTAssertTrue([expected isEqualToArray:[FlattenArrayExample flattenArray:inputArray]]);
|
63
|
-
|
39
|
+
- (void)testSixLevelNestingWithNullValues {
|
40
|
+
NSArray *inputArray = @[@0, @2, @[@[@2, @3], @8, @[@[@100]], nullValue, @[@[nullValue]]], @-2];
|
41
|
+
NSArray *expected = @[@0, @2, @2, @3, @8, @100, @-2];
|
42
|
+
XCTAssertEqualObjects(expected, [FlattenArrayExample flattenArray:inputArray]);
|
64
43
|
}
|
65
44
|
|
66
|
-
-(void)testAllValuesInNestedListAreNull{
|
67
|
-
|
68
|
-
NSNull *nullValue = [NSNull null];
|
69
|
-
NSArray *innerArray6 = [NSArray arrayWithObjects:nullValue,nullValue, nil];
|
70
|
-
NSArray *innerArray5 = [NSArray arrayWithObjects:innerArray6,nullValue, nil];
|
71
|
-
NSArray *innerArray4 = [NSArray arrayWithObject:nullValue];
|
72
|
-
NSArray *innerArray3 = [NSArray arrayWithObject:innerArray4];
|
73
|
-
NSArray *innerArray2 = [NSArray arrayWithObject:innerArray3];
|
74
|
-
NSArray *innerArray1 = [NSArray arrayWithObject:innerArray2];
|
75
|
-
NSArray *inputArray = [NSArray arrayWithObjects:nullValue,innerArray1,nullValue,nullValue,innerArray5,nullValue, nil];
|
45
|
+
- (void)testAllValuesInNestedListAreNull {
|
46
|
+
NSArray *inputArray = @[nullValue, @[@[@[@[nullValue]]]], nullValue, nullValue, @[@[nullValue, nullValue], nullValue], nullValue];
|
76
47
|
NSArray *expected = @[];
|
77
|
-
|
78
|
-
|
48
|
+
XCTAssertEqualObjects(expected, [FlattenArrayExample flattenArray:inputArray]);
|
79
49
|
}
|
80
50
|
|
81
|
-
-(void)testFiveLevelDeepNestedListWithDoubleValuesAndNullValues{
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
NSArray *innerArray4 = [NSArray arrayWithObject:innerArray5];
|
86
|
-
NSArray *innerArray3 = [NSArray arrayWithObject:innerArray4];
|
87
|
-
NSArray *innerArray2 = [NSArray arrayWithObjects:[NSNumber numberWithDouble:2.00005],[NSNumber numberWithDouble:3.13], nil];
|
88
|
-
NSArray *innerArray1 = [NSArray arrayWithObjects:innerArray2,[NSNumber numberWithDouble:8.4],[NSNumber numberWithDouble:100],[NSNumber numberWithDouble:4.8],innerArray3, nil];
|
89
|
-
NSArray *inputArray = [NSArray arrayWithObjects:[NSNumber numberWithDouble:0.085],[NSNumber numberWithDouble:2.8844557],innerArray1,[NSNumber numberWithDouble:-2.5], nil];
|
90
|
-
|
91
|
-
NSArray *expected = [NSArray arrayWithObjects:[NSNumber numberWithDouble:0.085],[NSNumber numberWithDouble:2.8844557],[NSNumber numberWithDouble:2.00005],[NSNumber numberWithDouble:3.13],[NSNumber numberWithDouble:8.4],[NSNumber numberWithDouble:100],[NSNumber numberWithDouble:4.8],[NSNumber numberWithDouble:-2.5], nil];
|
92
|
-
XCTAssertTrue([expected isEqualToArray:[FlattenArrayExample flattenArray:inputArray]]);
|
93
|
-
|
51
|
+
- (void)testFiveLevelDeepNestedListWithDoubleValuesAndNullValues {
|
52
|
+
NSArray *inputArray = @[@0.085, @2.8844557, @[@[@2.00005, @3.13], @8.4, @100, @4.8, @[@[@[nullValue]]]], @-2.5];
|
53
|
+
NSArray *expected = @[@0.085, @2.8844557, @2.00005, @3.13, @8.4, @100, @4.8, @-2.5];
|
54
|
+
XCTAssertEqualObjects(expected, [FlattenArrayExample flattenArray:inputArray]);
|
94
55
|
}
|
95
56
|
|
96
|
-
-(void)testSixLevelDeepNestedListWithStringsAndNullValues{
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
NSArray *innerArray5 = [NSArray arrayWithObject:innerArray6];
|
101
|
-
NSArray *innerArray4 = [NSArray arrayWithObject:@"One Hundred"];
|
102
|
-
NSArray *innerArray3 = [NSArray arrayWithObject:innerArray4];
|
103
|
-
NSArray *innerArray2 = [NSArray arrayWithObjects:@"Two",@"three", nil];
|
104
|
-
NSArray *innerArray1 = [NSArray arrayWithObjects:innerArray2,@"eight",innerArray3,nullValue,innerArray5, nil];
|
105
|
-
NSArray *inputArray = [NSArray arrayWithObjects:@"Zero",@"two",innerArray1,@"minus two", nil];
|
106
|
-
NSArray *expected = [NSArray arrayWithObjects:@"Zero",@"two",@"Two",@"three",@"eight",@"One Hundred",@"minus two", nil];
|
107
|
-
XCTAssertTrue([expected isEqualToArray:[FlattenArrayExample flattenArray:inputArray]]);
|
108
|
-
|
57
|
+
- (void)testSixLevelDeepNestedListWithStringsAndNullValues {
|
58
|
+
NSArray *inputArray = @[@"Zero", @"two", @[@[@[@"Two", @"three"]], @"eight", @[@[@"One Hundred"]], nullValue, @[@[nullValue]]], @"minus two"];
|
59
|
+
NSArray *expected = @[@"Zero", @"two", @"Two", @"three", @"eight", @"One Hundred", @"minus two"];
|
60
|
+
XCTAssertEqualObjects(expected, [FlattenArrayExample flattenArray:inputArray]);
|
109
61
|
}
|
110
62
|
@end
|
@@ -10,129 +10,106 @@
|
|
10
10
|
|
11
11
|
@end
|
12
12
|
|
13
|
-
@implementation SublistTest
|
14
13
|
|
14
|
+
@implementation SublistTest
|
15
15
|
|
16
16
|
- (void)testEmptyLists {
|
17
|
-
|
18
17
|
XCTAssertEqualObjects(@"equal", [SublistExample classifierForFirstList:@[] andSecondList:@[]]);
|
19
18
|
}
|
20
19
|
|
21
|
-
- (void)testEmptyListWithinNonEmptyList{
|
22
|
-
|
23
|
-
NSArray *secondList = [NSArray arrayWithObjects:[NSNumber numberWithInt:1],[NSNumber numberWithInt:2],[NSNumber numberWithInt:3], nil];
|
20
|
+
- (void)testEmptyListWithinNonEmptyList {
|
21
|
+
NSArray *secondList = @[@1, @2, @3];
|
24
22
|
XCTAssertEqualObjects(@"sublist", [SublistExample classifierForFirstList:@[] andSecondList:secondList]);
|
25
23
|
|
26
24
|
}
|
27
25
|
|
28
|
-
- (void)testNonEmptyListContainsEmptyList{
|
29
|
-
|
30
|
-
NSArray *firstList = [NSArray arrayWithObjects:[NSNumber numberWithInt:1],[NSNumber numberWithInt:2],[NSNumber numberWithInt:3], nil];
|
26
|
+
- (void)testNonEmptyListContainsEmptyList {
|
27
|
+
NSArray *firstList = @[@1, @2, @3];
|
31
28
|
XCTAssertEqualObjects(@"superlist", [SublistExample classifierForFirstList:firstList andSecondList:@[]]);
|
32
29
|
}
|
33
30
|
|
34
|
-
- (void)testListEqualsItself{
|
35
|
-
|
36
|
-
NSArray *
|
37
|
-
NSArray *secondList = [NSArray arrayWithObjects:[NSNumber numberWithInt:1],[NSNumber numberWithInt:2],[NSNumber numberWithInt:3], nil];
|
31
|
+
- (void)testListEqualsItself {
|
32
|
+
NSArray *firstList = @[@1, @2, @3];
|
33
|
+
NSArray *secondList = @[@1, @2, @3];
|
38
34
|
XCTAssertEqualObjects(@"equal", [SublistExample classifierForFirstList:firstList andSecondList:secondList]);
|
39
35
|
}
|
40
36
|
|
41
|
-
-(void)testDifferentLists{
|
42
|
-
|
43
|
-
NSArray *
|
44
|
-
NSArray *secondList = [NSArray arrayWithObjects:[NSNumber numberWithInt:2],[NSNumber numberWithInt:3],[NSNumber numberWithInt:4], nil];
|
37
|
+
- (void)testDifferentLists {
|
38
|
+
NSArray *firstList = @[@1, @2, @3];
|
39
|
+
NSArray *secondList = @[@2, @3, @4];
|
45
40
|
XCTAssertEqualObjects(@"unequal", [SublistExample classifierForFirstList:firstList andSecondList:secondList]);
|
46
41
|
}
|
47
42
|
|
48
|
-
-(void)testFalseStart{
|
49
|
-
|
50
|
-
NSArray *
|
51
|
-
NSArray *secondList = [NSArray arrayWithObjects:[NSNumber numberWithInt:0],[NSNumber numberWithInt:1],[NSNumber numberWithInt:2],[NSNumber numberWithInt:3],[NSNumber numberWithInt:1],[NSNumber numberWithInt:2],[NSNumber numberWithInt:5],[NSNumber numberWithInt:6], nil];
|
43
|
+
- (void)testFalseStart {
|
44
|
+
NSArray *firstList = @[@1, @2, @5];
|
45
|
+
NSArray *secondList = @[@0, @1, @2, @3, @1, @2, @5, @6];
|
52
46
|
XCTAssertEqualObjects(@"sublist", [SublistExample classifierForFirstList:firstList andSecondList:secondList]);
|
53
47
|
}
|
54
48
|
|
55
|
-
-(void)testConsecutive{
|
56
|
-
|
57
|
-
NSArray *
|
58
|
-
NSArray *secondList = [NSArray arrayWithObjects:[NSNumber numberWithInt:0],[NSNumber numberWithInt:1],[NSNumber numberWithInt:1],[NSNumber numberWithInt:1],[NSNumber numberWithInt:2],[NSNumber numberWithInt:1],[NSNumber numberWithInt:2], nil];
|
49
|
+
- (void)testConsecutive {
|
50
|
+
NSArray *firstList = @[@1, @1, @2];
|
51
|
+
NSArray *secondList = @[@0, @1, @1, @1, @2, @1, @2];
|
59
52
|
XCTAssertEqualObjects(@"sublist", [SublistExample classifierForFirstList:firstList andSecondList:secondList]);
|
60
53
|
}
|
61
54
|
|
62
|
-
-(void)testSublistAtStart{
|
63
|
-
|
64
|
-
NSArray *
|
65
|
-
NSArray *secondList = [NSArray arrayWithObjects:[NSNumber numberWithInt:0],[NSNumber numberWithInt:1],[NSNumber numberWithInt:2],[NSNumber numberWithInt:3],[NSNumber numberWithInt:4],[NSNumber numberWithInt:5], nil];
|
55
|
+
- (void)testSublistAtStart {
|
56
|
+
NSArray *firstList = @[@0, @1, @2];
|
57
|
+
NSArray *secondList = @[@0, @1, @2, @3, @4, @5];
|
66
58
|
XCTAssertEqualObjects(@"sublist", [SublistExample classifierForFirstList:firstList andSecondList:secondList]);
|
67
59
|
}
|
68
60
|
|
69
|
-
-(void)testSublistInMiddle{
|
61
|
+
- (void)testSublistInMiddle{
|
70
62
|
|
71
|
-
NSArray *firstList = [
|
72
|
-
NSArray *secondList = [
|
63
|
+
NSArray *firstList = @[@2, @3, @4];
|
64
|
+
NSArray *secondList = @[@0, @1, @2, @3, @4, @5];
|
73
65
|
XCTAssertEqualObjects(@"sublist", [SublistExample classifierForFirstList:firstList andSecondList:secondList]);
|
74
66
|
}
|
75
67
|
|
76
|
-
-(void)testSublistAtEnd{
|
77
|
-
|
78
|
-
NSArray *
|
79
|
-
NSArray *secondList = [NSArray arrayWithObjects:[NSNumber numberWithInt:0],[NSNumber numberWithInt:1],[NSNumber numberWithInt:2],[NSNumber numberWithInt:3],[NSNumber numberWithInt:4],[NSNumber numberWithInt:5], nil];
|
68
|
+
- (void)testSublistAtEnd {
|
69
|
+
NSArray *firstList = @[@3, @4, @5];
|
70
|
+
NSArray *secondList = @[@0, @1, @2, @3, @4, @5];
|
80
71
|
XCTAssertEqualObjects(@"sublist", [SublistExample classifierForFirstList:firstList andSecondList:secondList]);
|
81
72
|
}
|
82
73
|
|
83
|
-
-(void)testAtStartOfSuperlist{
|
84
|
-
|
85
|
-
NSArray *
|
86
|
-
NSArray *secondList = [NSArray arrayWithObjects:[NSNumber numberWithInt:0],[NSNumber numberWithInt:1],[NSNumber numberWithInt:2], nil];
|
87
|
-
;
|
74
|
+
- (void)testAtStartOfSuperlist {
|
75
|
+
NSArray *firstList = @[@0, @1, @2, @3, @4, @5];
|
76
|
+
NSArray *secondList = @[@0, @1, @2];
|
88
77
|
XCTAssertEqualObjects(@"superlist", [SublistExample classifierForFirstList:firstList andSecondList:secondList]);
|
89
78
|
}
|
90
79
|
|
91
|
-
-(void)testAtMiddleOfSuperlist{
|
92
|
-
|
93
|
-
NSArray *
|
94
|
-
NSArray *secondList = [NSArray arrayWithObjects:[NSNumber numberWithInt:2],[NSNumber numberWithInt:3], nil];
|
95
|
-
;
|
80
|
+
- (void)testAtMiddleOfSuperlist {
|
81
|
+
NSArray *firstList = @[@0, @1, @2, @3, @4, @5];
|
82
|
+
NSArray *secondList = @[@2, @3];
|
96
83
|
XCTAssertEqualObjects(@"superlist", [SublistExample classifierForFirstList:firstList andSecondList:secondList]);
|
97
84
|
}
|
98
85
|
|
99
|
-
-(void)testAtEndOfSuperlist{
|
100
|
-
|
101
|
-
NSArray *
|
102
|
-
NSArray *secondList = [NSArray arrayWithObjects:[NSNumber numberWithInt:3],[NSNumber numberWithInt:4],[NSNumber numberWithInt:5], nil];
|
103
|
-
;
|
86
|
+
- (void)testAtEndOfSuperlist {
|
87
|
+
NSArray *firstList = @[@0, @1, @2, @3, @4, @5];
|
88
|
+
NSArray *secondList = @[@3, @4, @5];
|
104
89
|
XCTAssertEqualObjects(@"superlist", [SublistExample classifierForFirstList:firstList andSecondList:secondList]);
|
105
90
|
}
|
106
91
|
|
107
|
-
-(void)testFirstListMissingElementFromSecondList{
|
108
|
-
|
109
|
-
NSArray *
|
110
|
-
NSArray *secondList = [NSArray arrayWithObjects:[NSNumber numberWithInt:1],[NSNumber numberWithInt:2],[NSNumber numberWithInt:3], nil];
|
111
|
-
;
|
92
|
+
- (void)testFirstListMissingElementFromSecondList {
|
93
|
+
NSArray *firstList = @[@1, @3];
|
94
|
+
NSArray *secondList = @[@1, @2, @3];
|
112
95
|
XCTAssertEqualObjects(@"unequal", [SublistExample classifierForFirstList:firstList andSecondList:secondList]);
|
113
96
|
}
|
114
97
|
|
115
|
-
-(void)testSecondListMissingOneElementFromFirstList{
|
116
|
-
|
117
|
-
NSArray *
|
118
|
-
NSArray *secondList = [NSArray arrayWithObjects:[NSNumber numberWithInt:1],[NSNumber numberWithInt:3], nil];
|
119
|
-
;
|
98
|
+
- (void)testSecondListMissingOneElementFromFirstList {
|
99
|
+
NSArray *firstList = @[@1, @2, @3];
|
100
|
+
NSArray *secondList = @[@1, @3];
|
120
101
|
XCTAssertEqualObjects(@"unequal", [SublistExample classifierForFirstList:firstList andSecondList:secondList]);
|
121
102
|
}
|
122
103
|
|
123
|
-
-(void)testOrderMattersToAList{
|
124
|
-
|
125
|
-
NSArray *
|
126
|
-
NSArray *secondList = [NSArray arrayWithObjects:[NSNumber numberWithInt:3],[NSNumber numberWithInt:2],[NSNumber numberWithInt:1], nil];
|
127
|
-
;
|
104
|
+
- (void)testOrderMattersToAList {
|
105
|
+
NSArray *firstList = @[@1, @2, @3];
|
106
|
+
NSArray *secondList = @[@3, @2, @1];
|
128
107
|
XCTAssertEqualObjects(@"unequal", [SublistExample classifierForFirstList:firstList andSecondList:secondList]);
|
129
108
|
}
|
130
109
|
|
131
|
-
-(void)testSameDigitsButDifferentNumbers{
|
132
|
-
|
133
|
-
NSArray *
|
134
|
-
NSArray *secondList = [NSArray arrayWithObjects:[NSNumber numberWithInt:10],[NSNumber numberWithInt:1], nil];
|
135
|
-
;
|
110
|
+
- (void)testSameDigitsButDifferentNumbers {
|
111
|
+
NSArray *firstList = @[@1, @0, @1];
|
112
|
+
NSArray *secondList = @[@10, @1];
|
136
113
|
XCTAssertEqualObjects(@"unequal", [SublistExample classifierForFirstList:firstList andSecondList:secondList]);
|
137
114
|
}
|
138
115
|
|
@@ -0,0 +1 @@
|
|
1
|
+
unit module Allergies:ver<1>;
|
@@ -1,3 +1,5 @@
|
|
1
|
+
unit module Allergies:ver<1>;
|
2
|
+
|
1
3
|
our @allergens = <
|
2
4
|
eggs
|
3
5
|
peanuts
|
@@ -10,7 +12,7 @@ our @allergens = <
|
|
10
12
|
>;
|
11
13
|
|
12
14
|
sub allergic-to($code,$substance) is export {
|
13
|
-
return so $code +& ( 2 ** @allergens.first({ $_ eq $substance},:k) )
|
15
|
+
return so $code +& ( 2 ** @allergens.first({ $_ eq $substance},:k) )
|
14
16
|
}
|
15
17
|
|
16
18
|
sub list-allergies($code) is export {
|