Skip to content
Open

Etl #49

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions exercism/anagram/anagram.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,63 +9,63 @@ describe('Anagram', function() {
expect(matches).toEqual([]);
});

xit('detects simple anagram',function() {
it('detects simple anagram',function() {
var subject = new Anagram('ant');
var matches = subject.matches(['tan', 'stand', 'at']);

expect(matches).toEqual(['tan']);
});

xit('does not detect false positives',function() {
it('does not detect false positives',function() {
var subject = new Anagram('galea');
var matches = subject.matches(['eagle']);

expect(matches).toEqual([]);
});

xit('detects multiple anagrams',function() {
it('detects multiple anagrams',function() {
var subject = new Anagram('master');
var matches = subject.matches(['stream', 'pigeon', 'maters']);

expect(matches).toEqual(['stream', 'maters']);
});

xit('does not detect anagram subsets',function() {
it('does not detect anagram subsets',function() {
var subject = new Anagram('good');
var matches = subject.matches(['dog', 'goody']);

expect(matches).toEqual([]);
});

xit('detects anagram',function() {
it('detects anagram',function() {
var subject = new Anagram('listen');
var matches = subject.matches(['enlists', 'google', 'inlets', 'banana']);

expect(matches).toEqual(['inlets']);
});

xit('detects multiple anagrams',function() {
it('detects multiple anagrams',function() {
var subject = new Anagram('allergy');
var matches = subject.matches(['gallery', 'ballerina', 'regally', 'clergy', 'largely', 'leading']);

expect(matches).toEqual(['gallery', 'regally', 'largely']);
});

xit('detects anagrams case-insensitively',function() {
it('detects anagrams case-insensitively',function() {
var subject = new Anagram('Orchestra');
var matches = subject.matches(['cashregister', 'Carthorse', 'radishes']);

expect(matches).toEqual(['Carthorse']);
});

xit('does not detect a word as its own anagram',function() {
it('does not detect a word as its own anagram',function() {
var subject = new Anagram('banana');
var matches = subject.matches(['Banana']);

expect(matches).toEqual([]);
});

xit('matches() accepts string arguments',function() {
it('matches() accepts string arguments',function() {
var subject = new Anagram('ant');
var matches = subject.matches('stand', 'tan', 'at');

Expand Down
35 changes: 35 additions & 0 deletions exercism/binary-search/binary-search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function BinarySearch( arr ) {
//an object taht has a state and the reason it can change is because it has some
//data it's holding onto and some functions that can act on that data.
//that means there's a state change
this.arr = arr
}

BinarySearch.prototype.indexOf = function( value ) {
//check if this.arr is sorted
//

// on the prototoype of bin search we're gonna have a method called index of

}

java

var checkIfArrayIsSorted = function(arr) {
for(var i = 0; i < arr.length; i ++) {
if (arr[i] < arr[i+1]) {
return true;
} else {
return false;
}
}
}

c++


for(var i = 0; i < thing.length; i++) {
if (thing[i] > thing[i+1]) {
console.log('false');
}
}
20 changes: 20 additions & 0 deletions exercism/etl/etl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
function ETL() {

}

ETL.prototype.transform = function( oldData ) {
var newData = {}

for ( prop in oldData ) {
var individualArray = oldData[prop]

while ( individualArray.length > 0 ) {
var letter = individualArray.pop().toLowerCase()

newData[letter] = Number(prop)
}
}
return newData
}

module.exports = ETL
7 changes: 4 additions & 3 deletions exercism/etl/etl.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@ var ETL = require('./etl');
describe('Transform', function() {
var etl = new ETL();


it('transforms one value', function() {
var old = { 1: ['A'] };
var expected = { a: 1 };

expect(etl.transform(old)).toEqual(expected);
});

xit('transforms more values', function() {
it('transforms more values', function() {
var old = { 1: ['A', 'E', 'I', 'O', 'U'] };
var expected = { a: 1, e: 1, i: 1, o: 1, u: 1 };

expect(etl.transform(old)).toEqual(expected);
});

xit('transforms more keys', function() {
it('transforms more keys', function() {
var old = { 1: ['A', 'E'], 2: ['D', 'G'] };
var expected = { a: 1, e: 1, d: 2, g: 2 };

expect(etl.transform(old)).toEqual(expected);
});

xit('transforms a full dataset', function() {
it('transforms a full dataset', function() {
var old = {
1: [ 'A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T' ],
2: [ 'D', 'G' ],
Expand Down
17 changes: 9 additions & 8 deletions exercism/pangram/pangram.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,43 @@ describe('Pangram()', function() {
expect(pangram.isPangram()).toBe(false);
});

xit('pangram with only lower case', function() {
it('pangram with only lower case', function() {
var pangram = new Pangram("the quick brown fox jumps over the lazy dog");
expect(pangram.isPangram()).toBe(true);
});

xit("missing character 'x'", function() {
it("missing character 'x'", function() {
var pangram = new Pangram("a quick movement of the enemy will jeopardize five gunboats");
expect(pangram.isPangram()).toBe(false);
});

xit("another missing character 'x'", function() {
it("another missing character 'x'", function() {
var pangram = new Pangram("the quick brown fish jumps over the lazy dog");
expect(pangram.isPangram()).toBe(false);
});

xit("pangram with underscores", function() {
it("pangram with underscores", function() {
var pangram = new Pangram("the_quick_brown_fox_jumps_over_the_lazy_dog");
expect(pangram.isPangram()).toBe(true);
});

xit("pangram with numbers", function() {
it("pangram with numbers", function() {
var pangram = new Pangram("the 1 quick brown fox jumps over the 2 lazy dogs");
expect(pangram.isPangram()).toBe(true);
});

xit('missing letters replaced by numbers', function() {
it('missing letters replaced by numbers', function() {
var pangram = new Pangram("7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog");
console.log()
expect(pangram.isPangram()).toBe(false);
});

xit('pangram with mixed case and punctuation', function() {
it('pangram with mixed case and punctuation', function() {
var pangram = new Pangram("\"Five quacking Zephyrs jolt my wax bed.\"");
expect(pangram.isPangram()).toBe(true);
});

xit('pangram with non-ascii characters', function() {
it('pangram with non-ascii characters', function() {
var pangram = new Pangram("Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich.");
expect(pangram.isPangram()).toBe(true);
});
Expand Down