tracks/cfml/exercises/anagram/AnagramTest.cfc in trackler-2.2.1.104 vs tracks/cfml/exercises/anagram/AnagramTest.cfc in trackler-2.2.1.105
- old
+ new
@@ -1,27 +1,19 @@
-component extends="testbox.system.BaseSpec" {
-
- function beforeAll(){
- SUT = createObject( 'Anagram' );
- }
-
- function run(){
-
- describe( "My Anagram class", function(){
+component extends="testbox.system.BaseSpec" {
+ function beforeAll(){
+ SUT = createObject( 'Anagram' );
+ }
+
+ function run(){
+
+ describe( "My Anagram class", function(){
+
it( 'no matches', function(){
expect( SUT.anagrams( subject='diaper', candidates=["hello", "world", "zombies", "pants"] ) ).toBe( [] );
});
- it( 'detects simple anagram', function(){
- expect( SUT.anagrams( subject='ant', candidates=["tan", "stand", "at"] ) ).toBe( ["tan"] );
- });
-
- it( 'does not detect false positives', function(){
- expect( SUT.anagrams( subject='galea', candidates=["eagle"] ) ).toBe( [] );
- });
-
it( 'detects two anagrams', function(){
expect( SUT.anagrams( subject='master', candidates=["stream", "pigeon", "maters"] ) ).toBe( ["stream","maters"] );
});
it( 'does not detect anagram subsets', function(){
@@ -34,14 +26,10 @@
it( 'detects three anagrams', function(){
expect( SUT.anagrams( subject='allergy', candidates=["gallery", "ballerina", "regally", "clergy", "largely", "leading"] ) ).toBe( ["gallery","regally","largely"] );
});
- it( 'does not detect identical words', function(){
- expect( SUT.anagrams( subject='corn', candidates=["corn", "dark", "Corn", "rank", "CORN", "cron", "park"] ) ).toBe( ["cron"] );
- });
-
it( 'does not detect non-anagrams with identical checksum', function(){
expect( SUT.anagrams( subject='mass', candidates=["last"] ) ).toBe( [] );
});
it( 'detects anagrams case-insensitively', function(){
@@ -54,14 +42,10 @@
it( 'detects anagrams using case-insensitive possible matches', function(){
expect( SUT.anagrams( subject='orchestra', candidates=["cashregister", "Carthorse", "radishes"] ) ).toBe( ["Carthorse"] );
});
- it( 'does not detect a word as its own anagram', function(){
- expect( SUT.anagrams( subject='banana', candidates=["Banana"] ) ).toBe( [] );
- });
-
it( 'does not detect a anagram if the original word is repeated', function(){
expect( SUT.anagrams( subject='go', candidates=["go Go GO"] ) ).toBe( [] );
});
it( 'anagrams must use all letters exactly once', function(){
@@ -69,11 +53,11 @@
});
it( 'capital word is not own anagram', function(){
expect( SUT.anagrams( subject='BANANA', candidates=["Banana"] ) ).toBe( [] );
});
-
- });
-
- }
-
+
+ });
+
+ }
+
}
\ No newline at end of file