From f3ca219110c4428bf1a89b470808cc12fa10c461 Mon Sep 17 00:00:00 2001 From: Adam Morris Date: Mon, 27 Jan 2020 17:35:17 +1000 Subject: [PATCH] renaming and change quotes --- exercises/accumulate/accumulate.spec.coffee | 6 +- exercises/anagram/anagram.spec.coffee | 84 +++++++++--------- ....spec.coffee => atbash-cipher.spec.coffee} | 2 +- exercises/beer-song/beer-song.spec.coffee | 36 ++++---- ....coffee => binary-search-tree.spec.coffee} | 2 +- exercises/bob/bob.spec.coffee | 88 +++++++++---------- exercises/clock/clock.spec.coffee | 45 +++++----- ...{hello_world.coffee => hello-world.coffee} | 0 ...ld.spec.coffee => hello-world.spec.coffee} | 4 +- exercises/hexadecimal/hexadecimal.spec.coffee | 44 +++++----- exercises/linked-list/linked-list.spec.coffee | 3 +- ...rime.spec.coffee => nth-prime.spec.coffee} | 4 +- .../nucleotide-count.spec.coffee | 2 +- ...coffee => palindrome-products.spec.coffee} | 14 +-- ...ec.coffee => pascals-triangle.spec.coffee} | 3 +- ...k.spec.coffee => queen-attack.spec.coffee} | 33 ++++--- exercises/triangle/triangle.spec.coffee | 10 +-- exercises/word-count/word-count.spec.coffee | 28 +++--- 18 files changed, 201 insertions(+), 207 deletions(-) rename exercises/atbash-cipher/{atbash_cipher.spec.coffee => atbash-cipher.spec.coffee} (95%) rename exercises/binary-search-tree/{binary_search_tree.spec.coffee => binary-search-tree.spec.coffee} (97%) rename exercises/hello-world/{hello_world.coffee => hello-world.coffee} (100%) rename exercises/hello-world/{hello_world.spec.coffee => hello-world.spec.coffee} (65%) rename exercises/nth-prime/{nth_prime.spec.coffee => nth-prime.spec.coffee} (79%) rename exercises/palindrome-products/{palindrome_products.spec.coffee => palindrome-products.spec.coffee} (75%) rename exercises/pascals-triangle/{pascal-triangle-spec.coffee => pascals-triangle.spec.coffee} (95%) rename exercises/queen-attack/{queen_attack.spec.coffee => queen-attack.spec.coffee} (58%) diff --git a/exercises/accumulate/accumulate.spec.coffee b/exercises/accumulate/accumulate.spec.coffee index 6d8d1f27..20fd3f3b 100644 --- a/exercises/accumulate/accumulate.spec.coffee +++ b/exercises/accumulate/accumulate.spec.coffee @@ -20,10 +20,10 @@ describe '[].accumulate()', -> accumulator = (word) -> word.split('').reverse().join('') result = 'the quick brown fox etc'.split(/\s/).accumulate accumulator - expect(result).toEqual ["eht", "kciuq", "nworb", "xof", "cte"] + expect(result).toEqual ['eht', 'kciuq', 'nworb', 'xof', 'cte'] xit 'accumulate recursively', -> result = 'a b c'.split(/\s+/).accumulate (char) -> - '1 2 3'.split(/\s+/).accumulate (digit) -> "#{char}#{digit}" + '1 2 3'.split(/\s+/).accumulate (digit) -> '#{char}#{digit}' - expect(result).toEqual([["a1", "a2", "a3"], ["b1", "b2", "b3"], ["c1", "c2", "c3"]]) + expect(result).toEqual([['a1', 'a2', 'a3'], ['b1', 'b2', 'b3'], ['c1', 'c2', 'c3']]) diff --git a/exercises/anagram/anagram.spec.coffee b/exercises/anagram/anagram.spec.coffee index d1b5d9b1..caa53fd2 100644 --- a/exercises/anagram/anagram.spec.coffee +++ b/exercises/anagram/anagram.spec.coffee @@ -1,56 +1,56 @@ -Anagram = require "./anagram" -describe "Anagram", -> - it "no matches", -> - detector = new Anagram "diaper" - matches = detector.match ["hello", "world", "zombies", "pants"] +Anagram = require './anagram' +describe 'Anagram', -> + it 'no matches', -> + detector = new Anagram 'diaper' + matches = detector.match ['hello', 'world', 'zombies', 'pants'] expect(matches).toEqual [] - xit "detects simple anagram", -> - detector = new Anagram "ant" - matches = detector.match ["tan", "stand", "at"] - expect(matches).toEqual ["tan"] + xit 'detects simple anagram', -> + detector = new Anagram 'ant' + matches = detector.match ['tan', 'stand', 'at'] + expect(matches).toEqual ['tan'] - xit "does not detect false positives", -> - detector = new Anagram "galea" - matches = detector.match ["eagle"] + xit 'does not detect false positives', -> + detector = new Anagram 'galea' + matches = detector.match ['eagle'] expect(matches).toEqual [] - xit "detects multiple anagrams", -> - detector = new Anagram "master" - matches = detector.match ["stream", "pigeon", "maters"] - expect(matches).toEqual ["stream", "maters"] + xit 'detects multiple anagrams', -> + detector = new Anagram 'master' + matches = detector.match ['stream', 'pigeon', 'maters'] + expect(matches).toEqual ['stream', 'maters'] - xit "does not detect anagram subsets", -> - detector = new Anagram "good" - matches = detector.match ["dog", "goody"] + xit 'does not detect anagram subsets', -> + detector = new Anagram 'good' + matches = detector.match ['dog', 'goody'] expect(matches).toEqual [] - xit "detects anagram", -> - detector = new Anagram "listen" - matches = detector.match ["enlists", "google", "inlets", "banana"] - expect(matches).toEqual ["inlets"] + xit 'detects anagram', -> + detector = new Anagram 'listen' + matches = detector.match ['enlists', 'google', 'inlets', 'banana'] + expect(matches).toEqual ['inlets'] - xit "detects multiple anagrams", -> - detector = new Anagram "allergy" - matches = detector.match ["gallery", "ballerina", "regally", "clergy", "largely", "leading"] - expect(matches).toEqual ["gallery", "regally", "largely"] + xit 'detects multiple anagrams', -> + detector = new Anagram 'allergy' + matches = detector.match ['gallery', 'ballerina', 'regally', 'clergy', 'largely', 'leading'] + expect(matches).toEqual ['gallery', 'regally', 'largely'] - xit "does not detect identical words", -> - detector = new Anagram "corn" - matches = detector.match ["corn", "dark", "Corn", "rank", "CORN", "cron", "park"] - expect(matches).toEqual ["cron"] + xit 'does not detect identical words', -> + detector = new Anagram 'corn' + matches = detector.match ['corn', 'dark', 'Corn', 'rank', 'CORN', 'cron', 'park'] + expect(matches).toEqual ['cron'] - xit "does not detect non-anagrams with identical checksum", -> - detector = new Anagram "mass" - matches = detector.match ["last"] + xit 'does not detect non-anagrams with identical checksum', -> + detector = new Anagram 'mass' + matches = detector.match ['last'] expect(matches).toEqual [] - xit "detects anagrams using case-insensitive subject", -> - detector = new Anagram "Orchestra" - matches = detector.match ["cashregister", "carthorse", "radishes"] - expect(matches).toEqual ["carthorse"] + xit 'detects anagrams using case-insensitive subject', -> + detector = new Anagram 'Orchestra' + matches = detector.match ['cashregister', 'carthorse', 'radishes'] + expect(matches).toEqual ['carthorse'] - xit "detects anagrams using case-insensitive candidates", -> - detector = new Anagram "orchestra" - matches = detector.match ["cashregister", "Carthorse", "radishes"] - expect(matches).toEqual ["carthorse"] + xit 'detects anagrams using case-insensitive candidates', -> + detector = new Anagram 'orchestra' + matches = detector.match ['cashregister', 'Carthorse', 'radishes'] + expect(matches).toEqual ['carthorse'] diff --git a/exercises/atbash-cipher/atbash_cipher.spec.coffee b/exercises/atbash-cipher/atbash-cipher.spec.coffee similarity index 95% rename from exercises/atbash-cipher/atbash_cipher.spec.coffee rename to exercises/atbash-cipher/atbash-cipher.spec.coffee index a277f9d0..44e34372 100644 --- a/exercises/atbash-cipher/atbash_cipher.spec.coffee +++ b/exercises/atbash-cipher/atbash-cipher.spec.coffee @@ -1,4 +1,4 @@ -Atbash = require './atbash' +Atbash = require './atbash-cipher' describe 'Atbash', -> it 'encodes no', -> diff --git a/exercises/beer-song/beer-song.spec.coffee b/exercises/beer-song/beer-song.spec.coffee index cdc82ce5..e54882bc 100644 --- a/exercises/beer-song/beer-song.spec.coffee +++ b/exercises/beer-song/beer-song.spec.coffee @@ -1,25 +1,25 @@ -Beer = require("./beer") -describe "Beer", -> - it "prints an arbitrary verse", -> - expect(Beer.verse 8).toEqual """ +Beer = require './beer-song' +describe 'Beer', -> + it 'prints an arbitrary verse', -> + expect(Beer.verse 8).toEqual ' 8 bottles of beer on the wall, 8 bottles of beer. Take one down and pass it around, 7 bottles of beer on the wall. - """ + ' - xit "handles 1 bottle", -> - expect(Beer.verse 1).toEqual """ + xit 'handles 1 bottle', -> + expect(Beer.verse 1).toEqual ' 1 bottle of beer on the wall, 1 bottle of beer. Take it down and pass it around, no more bottles of beer on the wall. - """ + ' - xit "handles 0 bottles", -> - expect(Beer.verse 0).toEqual """ + xit 'handles 0 bottles', -> + expect(Beer.verse 0).toEqual ' No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall. - """ + ' - xit "sings several verses", -> - expect(Beer.sing 8, 6).toEqual """ + xit 'sings several verses', -> + expect(Beer.sing 8, 6).toEqual ' 8 bottles of beer on the wall, 8 bottles of beer. Take one down and pass it around, 7 bottles of beer on the wall. @@ -29,10 +29,10 @@ describe "Beer", -> 6 bottles of beer on the wall, 6 bottles of beer. Take one down and pass it around, 5 bottles of beer on the wall. - """ + ' - xit "sings the rest of the verses", -> - expect(Beer.sing 3).toEqual """ + xit 'sings the rest of the verses', -> + expect(Beer.sing 3).toEqual ' 3 bottles of beer on the wall, 3 bottles of beer. Take one down and pass it around, 2 bottles of beer on the wall. @@ -45,6 +45,4 @@ describe "Beer", -> No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall. - """ - - + ' diff --git a/exercises/binary-search-tree/binary_search_tree.spec.coffee b/exercises/binary-search-tree/binary-search-tree.spec.coffee similarity index 97% rename from exercises/binary-search-tree/binary_search_tree.spec.coffee rename to exercises/binary-search-tree/binary-search-tree.spec.coffee index 6355c6a7..25081944 100644 --- a/exercises/binary-search-tree/binary_search_tree.spec.coffee +++ b/exercises/binary-search-tree/binary-search-tree.spec.coffee @@ -1,4 +1,4 @@ -Bst = require './bst' +Bst = require './binary-search-tree' recordAllData = (bst) -> out = [] diff --git a/exercises/bob/bob.spec.coffee b/exercises/bob/bob.spec.coffee index 435a5e32..428757c3 100644 --- a/exercises/bob/bob.spec.coffee +++ b/exercises/bob/bob.spec.coffee @@ -1,58 +1,58 @@ -Bob = require "./bob" -describe "Bob", -> +Bob = require './bob' +describe 'Bob', -> bob = new Bob() - it "stating something", -> - result = bob.hey "Tom-ay-to, tom-aaaah-to." - expect(result).toEqual "Whatever." + it 'stating something', -> + result = bob.hey 'Tom-ay-to, tom-aaaah-to.' + expect(result).toEqual 'Whatever.' - xit "shouting", -> - result = bob.hey "WATCH OUT!" - expect(result).toEqual "Whoa, chill out!" + xit 'shouting', -> + result = bob.hey 'WATCH OUT!' + expect(result).toEqual 'Whoa, chill out!' - xit "asking a question", -> - result = bob.hey "Does this cryogenic chamber make me look fat?" - expect(result).toEqual "Sure." + xit 'asking a question', -> + result = bob.hey 'Does this cryogenic chamber make me look fat?' + expect(result).toEqual 'Sure.' - xit "talking forcefully", -> - result = bob.hey "Let's go make out behind the gym!" - expect(result).toEqual "Whatever." + xit 'talking forcefully', -> + result = bob.hey 'Let's go make out behind the gym!' + expect(result).toEqual 'Whatever.' - xit "using acronyms in regular speech", -> - result = bob.hey "It's OK if you don't want to go to the DMV." - expect(result).toEqual "Whatever." + xit 'using acronyms in regular speech', -> + result = bob.hey 'It's OK if you don't want to go to the DMV.' + expect(result).toEqual 'Whatever.' - xit "forceful questions", -> - result = bob.hey "WHAT THE HELL WERE YOU THINKING?" - expect(result).toEqual "Whoa, chill out!" + xit 'forceful questions', -> + result = bob.hey 'WHAT THE HELL WERE YOU THINKING?' + expect(result).toEqual 'Whoa, chill out!' - xit "shouting numbers", -> - result = bob.hey "1, 2, 3 GO!" - expect(result).toEqual "Whoa, chill out!" + xit 'shouting numbers', -> + result = bob.hey '1, 2, 3 GO!' + expect(result).toEqual 'Whoa, chill out!' - xit "only number", -> - result = bob.hey "1, 2, 3" - expect(result).toEqual "Whatever." + xit 'only number', -> + result = bob.hey '1, 2, 3' + expect(result).toEqual 'Whatever.' - xit "shouting with special characters", -> - result = bob.hey "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!" - expect(result).toEqual "Whoa, chill out!" + xit 'shouting with special characters', -> + result = bob.hey 'ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!' + expect(result).toEqual 'Whoa, chill out!' - xit "shouting with no exclamation mark", -> - result = bob.hey "I HATE YOU" - expect(result).toEqual "Whoa, chill out!" + xit 'shouting with no exclamation mark', -> + result = bob.hey 'I HATE YOU' + expect(result).toEqual 'Whoa, chill out!' - xit "statement containing question mark", -> - result = bob.hey "Ending with a ? means a question." - expect(result).toEqual "Whatever." + xit 'statement containing question mark', -> + result = bob.hey 'Ending with a ? means a question.' + expect(result).toEqual 'Whatever.' - xit "prattling on", -> - result = bob.hey "Wait! Hang on. Are you going to be OK?" - expect(result).toEqual "Sure." + xit 'prattling on', -> + result = bob.hey 'Wait! Hang on. Are you going to be OK?' + expect(result).toEqual 'Sure.' - xit "silence", -> - result = bob.hey "" - expect(result).toEqual "Fine. Be that way!" + xit 'silence', -> + result = bob.hey '' + expect(result).toEqual 'Fine. Be that way!' - xit "prolonged silence", -> - result = bob.hey " " - expect(result).toEqual "Fine. Be that way!" + xit 'prolonged silence', -> + result = bob.hey ' ' + expect(result).toEqual 'Fine. Be that way!' diff --git a/exercises/clock/clock.spec.coffee b/exercises/clock/clock.spec.coffee index 815f2870..ee7dd276 100644 --- a/exercises/clock/clock.spec.coffee +++ b/exercises/clock/clock.spec.coffee @@ -1,47 +1,46 @@ Clock = require './clock' -describe "Clock", -> - it "prints the hour", -> - expect(Clock.at(8).toString()).toEqual "08:00" - expect(Clock.at(9).toString()).toEqual "09:00" +describe 'Clock', -> + it 'prints the hour', -> + expect(Clock.at(8).toString()).toEqual '08:00' + expect(Clock.at(9).toString()).toEqual '09:00' - xit "prints past the hour", -> - expect(Clock.at(11, 9).toString()).toEqual "11:09" - expect(Clock.at(11, 19).toString()).toEqual "11:19" + xit 'prints past the hour', -> + expect(Clock.at(11, 9).toString()).toEqual '11:09' + expect(Clock.at(11, 19).toString()).toEqual '11:19' - xit "can add minutes", -> + xit 'can add minutes', -> clock = Clock.at(10).plus 3 - expect(clock.toString()).toEqual "10:03" + expect(clock.toString()).toEqual '10:03' - xit "can add over an hour", -> + xit 'can add over an hour', -> clock = Clock.at(10).plus 61 - expect(clock.toString()).toEqual "11:01" + expect(clock.toString()).toEqual '11:01' - xit "wraps around midnight", -> + xit 'wraps around midnight', -> clock = Clock.at(23, 59).plus 2 - expect(clock.toString()).toEqual "00:01" + expect(clock.toString()).toEqual '00:01' - xit "can subtract minutes", -> + xit 'can subtract minutes', -> clock = Clock.at(10, 3).minus 3 - expect(clock.toString()).toEqual "10:00" + expect(clock.toString()).toEqual '10:00' - xit "can subtract over an hour", -> + xit 'can subtract over an hour', -> clock = Clock.at(10, 3).minus 30 - expect(clock.toString()).toEqual "09:33" + expect(clock.toString()).toEqual '09:33' clock = Clock.at(10, 3).minus 70 - expect(clock.toString()).toEqual "08:53" + expect(clock.toString()).toEqual '08:53' - xit "can know if it's equal to another clock", -> + xit 'can know if it's equal to another clock', -> clock1 = Clock.at(10, 3) clock2 = Clock.at(10, 3) expect(clock1.equals clock2).toBe true - xit "can know if it's not equal to another clock", -> + xit 'can know if it's not equal to another clock', -> clock1 = Clock.at(10, 3) clock2 = Clock.at(10, 4) expect(clock1.equals clock2).toBe false - xit "wraps around midnight backwards", -> + xit 'wraps around midnight backwards', -> clock = Clock.at(0, 3).minus 4 - expect(clock.toString()).toEqual "23:59" - + expect(clock.toString()).toEqual '23:59' diff --git a/exercises/hello-world/hello_world.coffee b/exercises/hello-world/hello-world.coffee similarity index 100% rename from exercises/hello-world/hello_world.coffee rename to exercises/hello-world/hello-world.coffee diff --git a/exercises/hello-world/hello_world.spec.coffee b/exercises/hello-world/hello-world.spec.coffee similarity index 65% rename from exercises/hello-world/hello_world.spec.coffee rename to exercises/hello-world/hello-world.spec.coffee index c5e6e037..f457f579 100644 --- a/exercises/hello-world/hello_world.spec.coffee +++ b/exercises/hello-world/hello-world.spec.coffee @@ -1,8 +1,8 @@ -HelloWorld = require "./hello_world" +HelloWorld = require './hello-world' describe 'HelloWorld', -> hello_world = new HelloWorld() - it "says 'Hello, World!'", -> + it 'says \'Hello, World!\'', -> result = hello_world.hello() expect(result).toEqual 'Hello, World!' diff --git a/exercises/hexadecimal/hexadecimal.spec.coffee b/exercises/hexadecimal/hexadecimal.spec.coffee index a442565e..a786126b 100644 --- a/exercises/hexadecimal/hexadecimal.spec.coffee +++ b/exercises/hexadecimal/hexadecimal.spec.coffee @@ -1,43 +1,43 @@ -Hexadecimal = require('./hexadecimal') +Hexadecimal = require './hexadecimal' -describe "Hexadecimal", -> +describe 'Hexadecimal', -> - it "hex 1 is decimal 1", -> - hex = new Hexadecimal("1") + it 'hex 1 is decimal 1', -> + hex = new Hexadecimal('1') expect(hex.toDecimal()).toEqual(1) - xit "hex c is decimal 12", -> - hex = new Hexadecimal("c") + xit 'hex c is decimal 12', -> + hex = new Hexadecimal('c') expect(hex.toDecimal()).toEqual(12) - xit "hex 10 is decimal 16", -> - hex = new Hexadecimal("10") + xit 'hex 10 is decimal 16', -> + hex = new Hexadecimal('10') expect(hex.toDecimal()).toEqual(16) - xit "hex af is decimal 175", -> - hex = new Hexadecimal("af") + xit 'hex af is decimal 175', -> + hex = new Hexadecimal('af') expect(hex.toDecimal()).toEqual(175) - xit "hex 100 is decimal 256", -> - hex = new Hexadecimal("100") + xit 'hex 100 is decimal 256', -> + hex = new Hexadecimal('100') expect(hex.toDecimal()).toEqual(256) - xit "hex 19ace is decimal 105166", -> - hex = new Hexadecimal("19ace") + xit 'hex 19ace is decimal 105166', -> + hex = new Hexadecimal('19ace') expect(hex.toDecimal()).toEqual(105166) - xit "invalid hex is decimal 0", -> - hex = new Hexadecimal("carrot") + xit 'invalid hex is decimal 0', -> + hex = new Hexadecimal('carrot') expect(hex.toDecimal()).toEqual(0) - xit "black", -> - hex = new Hexadecimal("000000") + xit 'black', -> + hex = new Hexadecimal('000000') expect(hex.toDecimal()).toEqual(0) - xit "white", -> - hex = new Hexadecimal("ffffff") + xit 'white', -> + hex = new Hexadecimal('ffffff') expect(hex.toDecimal()).toEqual(16777215) - xit "yellow", -> - hex = new Hexadecimal("ffff00") + xit 'yellow', -> + hex = new Hexadecimal('ffff00') expect(hex.toDecimal()).toEqual(16776960) diff --git a/exercises/linked-list/linked-list.spec.coffee b/exercises/linked-list/linked-list.spec.coffee index 64760f43..cdf23717 100644 --- a/exercises/linked-list/linked-list.spec.coffee +++ b/exercises/linked-list/linked-list.spec.coffee @@ -1,4 +1,4 @@ -LinkedList = require('./linkedList') +LinkedList = require './linked-list' describe 'LinkedList', -> it 'init', -> @@ -66,4 +66,3 @@ describe 'LinkedList', -> list.pushNode(10) list.deleteNode(10) expect(list.countNodes()).toBe 0 - diff --git a/exercises/nth-prime/nth_prime.spec.coffee b/exercises/nth-prime/nth-prime.spec.coffee similarity index 79% rename from exercises/nth-prime/nth_prime.spec.coffee rename to exercises/nth-prime/nth-prime.spec.coffee index 581e7324..4fdef710 100644 --- a/exercises/nth-prime/nth_prime.spec.coffee +++ b/exercises/nth-prime/nth-prime.spec.coffee @@ -1,4 +1,4 @@ -Prime = require './prime' +Prime = require './nth-prime' describe 'Prime', -> @@ -19,4 +19,4 @@ describe 'Prime', -> expect(prime).toEqual(104743) xit 'weird case', -> - expect(-> Prime.nth(0)).toThrow("Prime is not possible") + expect(-> Prime.nth(0)).toThrow('Prime is not possible') diff --git a/exercises/nucleotide-count/nucleotide-count.spec.coffee b/exercises/nucleotide-count/nucleotide-count.spec.coffee index cbbcd4fc..b5f80e50 100644 --- a/exercises/nucleotide-count/nucleotide-count.spec.coffee +++ b/exercises/nucleotide-count/nucleotide-count.spec.coffee @@ -1,4 +1,4 @@ -DNA = require './example' +DNA = require './nucleotide-count' describe 'DNA', -> it 'has no nucleotides', -> diff --git a/exercises/palindrome-products/palindrome_products.spec.coffee b/exercises/palindrome-products/palindrome-products.spec.coffee similarity index 75% rename from exercises/palindrome-products/palindrome_products.spec.coffee rename to exercises/palindrome-products/palindrome-products.spec.coffee index 7296cc88..8c460f74 100644 --- a/exercises/palindrome-products/palindrome_products.spec.coffee +++ b/exercises/palindrome-products/palindrome-products.spec.coffee @@ -1,36 +1,36 @@ -Palindromes = require('./palindromes') +Palindromes = require './palindrome-products' -describe "Palindrome", -> +describe 'Palindrome', -> - it "largest palindrome from single digit factors", -> + it 'largest palindrome from single digit factors', -> palindromes = new Palindromes({maxFactor: 9}) palindromes.generate() largest = palindromes.largest() expect(largest.value).toEqual(9) expect([[[3, 3], [1, 9]], [[1, 9], [3, 3]]]).toContain(largest.factors) - xit "largest palindrome from double digit factors", -> + xit 'largest palindrome from double digit factors', -> palindromes = new Palindromes({ maxFactor: 99, minFactor: 10 }) palindromes.generate() largest = palindromes.largest() expect(largest.value).toEqual(9009) expect(largest.factors).toEqual([[91, 99]]) - xit "smallest palindrome from double digit factors", -> + xit 'smallest palindrome from double digit factors', -> palindromes = new Palindromes({ maxFactor: 99, minFactor: 10 }) palindromes.generate() smallest = palindromes.smallest() expect(smallest.value).toEqual(121) expect(smallest.factors).toEqual([[11, 11]]) - xit "largest palindrome from triple digit factors", -> + xit 'largest palindrome from triple digit factors', -> palindromes = new Palindromes({ maxFactor: 999, minFactor: 100 }) palindromes.generate() largest = palindromes.largest() expect(largest.value).toEqual(906609) expect(largest.factors).toEqual([[913, 993]]) - xit "smallest palindrome from triple digit factors", -> + xit 'smallest palindrome from triple digit factors', -> palindromes = new Palindromes({ maxFactor: 999, minFactor: 100 }) palindromes.generate() smallest = palindromes.smallest() diff --git a/exercises/pascals-triangle/pascal-triangle-spec.coffee b/exercises/pascals-triangle/pascals-triangle.spec.coffee similarity index 95% rename from exercises/pascals-triangle/pascal-triangle-spec.coffee rename to exercises/pascals-triangle/pascals-triangle.spec.coffee index af441c13..180b4d15 100644 --- a/exercises/pascals-triangle/pascal-triangle-spec.coffee +++ b/exercises/pascals-triangle/pascals-triangle.spec.coffee @@ -1,4 +1,4 @@ -Pascal = require './example.coffee' +Pascal = require './pascals-triangle' describe 'Pascal', -> it 'with one row', -> @@ -24,4 +24,3 @@ describe 'Pascal', -> xit 'should equal 20th row', -> arr = new Pascal(20) expect(arr.array[19]).toEqual [1, 19, 171, 969, 3876, 11628, 27132, 50388, 75582, 92378, 92378, 75582, 50388, 27132, 11628, 3876, 969, 171, 19, 1] - diff --git a/exercises/queen-attack/queen_attack.spec.coffee b/exercises/queen-attack/queen-attack.spec.coffee similarity index 58% rename from exercises/queen-attack/queen_attack.spec.coffee rename to exercises/queen-attack/queen-attack.spec.coffee index 38ff743b..b62785e6 100644 --- a/exercises/queen-attack/queen_attack.spec.coffee +++ b/exercises/queen-attack/queen-attack.spec.coffee @@ -1,59 +1,58 @@ -Queens = require './queens' +Queens = require './queen-attack' -describe "Queens", -> - it "has the correct default positions", -> +describe 'Queens', -> + it 'has the correct default positions', -> queens = new Queens expect(queens.white).toEqual([0,3]) expect(queens.black).toEqual([7,3]) - xit "initialized with specific placement", -> + xit 'initialized with specific placement', -> queens = new Queens({white: [3,7], black: [6,1] }) expect(queens.white).toEqual([3, 7]) expect(queens.black).toEqual([6, 1]) - xit "cannot occupy the same space", -> + xit 'cannot occupy the same space', -> positioning = { white: [2,4], black: [2,4] } - expect(-> new Queens(positioning)).toThrow("Queens cannot share the same space") + expect(-> new Queens(positioning)).toThrow('Queens cannot share the same space') - xit "toString representation", -> + xit 'toString representation', -> positioning = {white: [2, 4], black: [6, 6]} queens = new Queens(positioning) - board = "_ _ _ _ _ _ _ _\n_ _ _ _ _ _ _ _\n_ _ _ _ _ _ _ _\n_ _ _ _ _ _ _ _\n" + - "_ _ W _ _ _ _ _\n_ _ _ _ _ _ _ _\n_ _ _ _ _ _ B _\n_ _ _ _ _ _ _ _" + board = '_ _ _ _ _ _ _ _\n_ _ _ _ _ _ _ _\n_ _ _ _ _ _ _ _\n_ _ _ _ _ _ _ _\n' + + '_ _ W _ _ _ _ _\n_ _ _ _ _ _ _ _\n_ _ _ _ _ _ B _\n_ _ _ _ _ _ _ _' expect(queens.toString()).toEqual(board) - xit "queens cannot attack", -> + xit 'queens cannot attack', -> queens = new Queens({ white: [2,3], black: [4,7] }) expect(queens.canAttack()).toEqual(false) - xit "queens can attack when they are on the same row", -> + xit 'queens can attack when they are on the same row', -> queens = new Queens({ white: [2,4], black: [2,7] }) expect(queens.canAttack()).toEqual(true) - xit "queens can attack when they are on the same column", -> + xit 'queens can attack when they are on the same column', -> queens = new Queens({ white: [5,4], black: [2,4] }) expect(queens.canAttack()).toEqual(true) - xit "queens can attack diagonally", -> + xit 'queens can attack diagonally', -> queens = new Queens({ white: [1, 1], black: [6, 6] }) expect(queens.canAttack()).toEqual(true) - xit "queens can attack another diagonally", -> + xit 'queens can attack another diagonally', -> queens = new Queens({ white: [0, 6], black: [1, 7] }) expect(queens.canAttack()).toEqual(true) - xit "queens can attack yet another diagonally", -> + xit 'queens can attack yet another diagonally', -> queens = new Queens({ white: [4, 1], black: [6, 3] }) expect(queens.canAttack()).toEqual(true) - xit "queens can attack yet yet another diagonally", -> + xit 'queens can attack yet yet another diagonally', -> queens = new Queens({ white: [6, 1], black: [1, 6] }) expect(queens.canAttack()).toEqual(true) - diff --git a/exercises/triangle/triangle.spec.coffee b/exercises/triangle/triangle.spec.coffee index a36be19b..664691dd 100644 --- a/exercises/triangle/triangle.spec.coffee +++ b/exercises/triangle/triangle.spec.coffee @@ -1,6 +1,6 @@ Triangle = require './triangle' -describe "Triangle", -> +describe 'Triangle', -> it 'is equilateral with equal sides', -> triangle = new Triangle(2,2,2) expect(triangle.kind()).toBe 'equilateral' @@ -42,13 +42,13 @@ describe "Triangle", -> expect(triangle.kind()).toBe 'scalene' xit 'is illegal when a side is negative', -> - expect(-> new Triangle(2,3,-5)).toThrow("negative sides are illegal") + expect(-> new Triangle(2,3,-5)).toThrow('negative sides are illegal') xit 'is illegal when violating triangle inequality', -> - expect(-> new Triangle(1,1,3)).toThrow("violation of triangle inequality") + expect(-> new Triangle(1,1,3)).toThrow('violation of triangle inequality') xit 'is illegal when violating triangle inequality 2', -> - expect(-> new Triangle(2,2,5)).toThrow("violation of triangle inequality") + expect(-> new Triangle(2,2,5)).toThrow('violation of triangle inequality') xit 'is illegal when violating triangle inequality 3', -> - expect(-> new Triangle(7,3,2)).toThrow("violation of triangle inequality") + expect(-> new Triangle(7,3,2)).toThrow('violation of triangle inequality') diff --git a/exercises/word-count/word-count.spec.coffee b/exercises/word-count/word-count.spec.coffee index 134ae701..17f1fe75 100644 --- a/exercises/word-count/word-count.spec.coffee +++ b/exercises/word-count/word-count.spec.coffee @@ -1,20 +1,20 @@ -Words = require "./words" +Words = require './word-count' -describe "Words", -> - it "counts one word", -> - words = new Words "word" +describe 'Words', -> + it 'counts one word', -> + words = new Words 'word' expect(words.count()).toEqual word: 1 - xit "counts one of each", -> - words = new Words "one of each" + xit 'counts one of each', -> + words = new Words 'one of each' expect(words.count()).toEqual one: 1 of: 1 each: 1 - xit "counts multiple occurrences", -> - words = new Words "one fish two fish red fish blue fish" + xit 'counts multiple occurrences', -> + words = new Words 'one fish two fish red fish blue fish' expect(words.count()).toEqual one: 1 fish: 4 @@ -22,8 +22,8 @@ describe "Words", -> red: 1 blue: 1 - xit "ignores punctuation", -> - words = new Words "car : carpet as java : javascript!!&@$%^&" + xit 'ignores punctuation', -> + words = new Words 'car : carpet as java : javascript!!&@$%^&' expect(words.count()).toEqual car: 1 carpet: 1 @@ -31,14 +31,14 @@ describe "Words", -> java: 1 javascript: 1 - xit "includes numbers", -> - words = new Words "testing, 1, 2 testing" + xit 'includes numbers', -> + words = new Words 'testing, 1, 2 testing' expect(words.count()).toEqual testing: 2 1: 1 2: 1 - xit "normalizes case", -> - words = new Words "go Go GO" + xit 'normalizes case', -> + words = new Words 'go Go GO' expect(words.count()).toEqual go: 3