Kumite (ko͞omiˌtā) is the practice of taking techniques learned from Kata and applying them through the act of freestyle sparring.
You can create a new kumite by providing some initial code and optionally some test cases. From there other warriors can spar with you, by enhancing, refactoring and translating your code. There is no limit to how many warriors you can spar with.
A great use for kumite is to begin an idea for a kata as one. You can collaborate with other code warriors until you have it right, then you can convert it to a kata.
public class BiggerNum{ /** * @param a integer of param1 * @param b integer of param2 * @return the bigger integer of a and b * If a equals b, eiter one is acceptance */ public static int compare(int a, int b) { return a >= b ? a : b; } }
- public class BiggerNum{
- /**
- * @param a integer of param1
- * @param b integer of param2
- * @return the bigger integer of a and b
- * If a equals b, eiter one is acceptance
- */
- public static int compare(int a, int b) {
if(a > b){return a;}else{return b;}- return a >= b ? a : b;
- }
- }
import org.junit.Test; import static org.junit.Assert.assertEquals; import org.junit.runners.JUnit4; // TODO: Replace examples and use TDD development by writing your own tests public class SolutionTest { @Test public void should_return_a_when_a_gt_b() { int a = 10; int b = 5; assertEquals(a, BiggerNum.compare(a, b)); } @Test public void should_return_b_when_a_lt_b() { int a = 4; int b = 5; assertEquals(b, BiggerNum.compare(a, b)); } @Test public void should_return_either_when_a_eq_b() { int a = 5; int b = 5; assertEquals(5, BiggerNum.compare(a, b)); } }
- import org.junit.Test;
- import static org.junit.Assert.assertEquals;
- import org.junit.runners.JUnit4;
- // TODO: Replace examples and use TDD development by writing your own tests
- public class SolutionTest {
- @Test
public void testSomething() {- public void should_return_a_when_a_gt_b() {
- int a = 10;
- int b = 5;
assertEquals(10, BiggerNum.compare(a, b));- assertEquals(a, BiggerNum.compare(a, b));
- }
- @Test
- public void should_return_b_when_a_lt_b() {
- int a = 4;
- int b = 5;
- assertEquals(b, BiggerNum.compare(a, b));
- }
- @Test
- public void should_return_either_when_a_eq_b() {
- int a = 5;
- int b = 5;
- assertEquals(5, BiggerNum.compare(a, b));
- }
- }
getDividors = n => Array.from({length: n}, (e, i) => n % ++i ? i : 0).filter(e => e)
const getDividors = (n, result = []) => {for (let i = 1; i <= Math.floor(Math.sqrt(n)); i++)if (n % i === 0) { result.push(i); if (n / i !== i) result.push(n / i) }return result; // output array won't be sorted}- getDividors = n => Array.from({length: n}, (e, i) => n % ++i ? i : 0).filter(e => e)
My version with few improvements.
#include <string> bool hasCapital(const std::string& password) { bool result = false; for(auto symbol : password) { if(symbol >= 'A' && symbol <= 'Z') { result = true; break; } } return result; } bool hasSpecial(const std::string& password) { bool result = false; const std::string specials("!\"#$%&'()*+'-./;:<>=?"); for(auto spec : specials) { if(password.find(spec) != -1) { result = true; break; } } return result; } bool hasDigit(const std::string& password) { bool result = false; for(auto symbol : password) { if(symbol >= '0' && symbol <= '9') { result = true; break; } } return result; } bool isLongPassword(const std::string& password) { return password.length() > 7; } bool testPassword(const std::string& password) { bool cap = hasCapital(password); bool spec = hasSpecial(password); bool digit = hasDigit(password); bool number = isLongPassword(password); return cap && spec && digit && number; }
- #include <string>
bool hasCapital(std::string password)- bool hasCapital(const std::string& password)
- {
for(int i=0; i < password.length(); i++){if (password[i] > 64 && password[i] < 91)- bool result = false;
- for(auto symbol : password)
- {
return true;- if(symbol >= 'A' && symbol <= 'Z')
- {
- result = true;
- break;
- }
- }
}return false;- return result;
- }
bool hasSpecial(std::string password)- bool hasSpecial(const std::string& password)
- {
char temp;for(int i=0;i<password.length();i++){temp = password[i];if ((temp > 32 && temp < 48) || (temp > 57 && temp < 64))- bool result = false;
- const std::string specials("!\"#$%&'()*+'-./;:<>=?");
- for(auto spec : specials)
- {
return true;- if(password.find(spec) != -1)
- {
- result = true;
- break;
- }
- }
- return result;
- }
- bool hasDigit(const std::string& password)
- {
- bool result = false;
- for(auto symbol : password)
- {
- if(symbol >= '0' && symbol <= '9')
- {
- result = true;
- break;
- }
- }
}return false;- return result;
- }
bool isLongPassword(std::string password)- bool isLongPassword(const std::string& password)
- {
return password.length() > 7;- return password.length() > 7;
- }
bool testPassword(std::string password)- bool testPassword(const std::string& password)
- {
- bool cap = hasCapital(password);
- bool spec = hasSpecial(password);
- bool digit = hasDigit(password);
- bool number = isLongPassword(password);
//provide final answerif (cap && number && spec){return true;}else{return false;}- return cap && spec && digit && number;
- }
Started with 3, because why waste 2 loops on answers you know aren't correct.
function test(n) { let sum=0; for (let i=3; i<n; i++){ if ((i%3==0) || (i%5==0)){ sum+=i; } } return sum; }
//if you have any Suggestion or noticed a mistake in my code ...tell me...i would need that...- function test(n) {
var sum=0;for (i=1; i<n; i++){- let sum=0;
- for (let i=3; i<n; i++){
- if ((i%3==0) || (i%5==0)){
- sum+=i;
- }
- }
- return sum;
- }
Use STL algorithms, take vector arguments by constant reference and functors by their exact type to avoid overhead of std::function.
#include <numeric> using namespace std; template<class F, class T, class U = decltype(std::declval<F>()(std::declval<T>()))> vector<U> vectorMap(const vector<T>& v, F f) { vector<U> result (v.size()); std::transform(v.begin(), v.end(), result.begin(), std::move(f)); return result; } template<class F, class T> vector<T> vectorFilter(const vector<T>& v, F f) { vector<T> result; std::copy_if(v.begin(), v.end(), std::back_inserter(result), std::move(f)); return result; } template<class F, class T, class U> U vectorReduce(const vector<T>& v, F f, U u) { return std::accumulate(v.begin(), v.end(), u, std::move(f)); }
- #include <numeric>
- using namespace std;
template<class T, class U> vector<U> vectorMap(vector<T> v, function<U (T)> f) {size_t size = v.size();vector<U> result (size);for (size_t i = 0; i < size; i++) result[i] = f(v[i]);- template<class F, class T, class U = decltype(std::declval<F>()(std::declval<T>()))> vector<U> vectorMap(const vector<T>& v, F f) {
- vector<U> result (v.size());
- std::transform(v.begin(), v.end(), result.begin(), std::move(f));
- return result;
- }
template<class T> vector<T> vectorFilter(vector<T> v, function<bool (T)> f) {- template<class F, class T> vector<T> vectorFilter(const vector<T>& v, F f) {
- vector<T> result;
for (size_t i = 0; i < v.size(); i++) if (f(v[i])) result.push_back(v[i]);- std::copy_if(v.begin(), v.end(), std::back_inserter(result), std::move(f));
- return result;
- }
template<class T, class U> U vectorReduce(vector<T> v, function<U (U, T)> f, U u) {U result = u;for (size_t i = 0; i < v.size(); i++) result = f(result, v[i]);return result;- template<class F, class T, class U> U vectorReduce(const vector<T>& v, F f, U u) {
- return std::accumulate(v.begin(), v.end(), u, std::move(f));
- }
#include <string> using namespace std; Describe(the_generic_vector_map_function) { It(should_correctly_map_an_int_vector_to_an_int_vector) { Assert::That(vectorMap(vector<int> {2, -7, 5, -4, 3}, [] (int n) -> int {return n * -2;}), EqualsContainer(vector<int> {-4, 14, -10, 8, -6})); } It(should_correctly_map_an_int_vector_to_a_string_vector) { Assert::That(vectorMap(vector<int> {13, 27, -2, 33, 666, 11723}, [] (int n) -> string {return to_string(n);}), EqualsContainer(vector<string> {"13", "27", "-2", "33", "666", "11723"})); } }; Describe(the_generic_vector_filter_function) { It(should_correctly_filter_an_int_vector) { Assert::That(vectorFilter(vector<int> {4, 6, 9, 16, -5, -28}, [] (int n) -> bool {return n % 2 != 0;}), EqualsContainer(vector<int> {9, -5})); Assert::That(vectorFilter(vector<int> {4, 6, 9, 16, -5, -28}, [] (int n) -> bool {return n % 2 == 0;}), EqualsContainer(vector<int> {4, 6, 16, -28})); } It(should_correctly_filter_a_string_vector) { Assert::That(vectorFilter(vector<string> {"Hello World", "Goodbye World", "hello", "meow", "goodbye"}, [] (string s) -> bool {return s.find("Hello") != string::npos || s.find("hello") != string::npos;}), EqualsContainer(vector<string> {"Hello World", "hello"})); Assert::That(vectorFilter(vector<string> {"Hello World", "Goodbye World", "hello", "meow", "goodbye"}, [] (string s) -> bool {return s.find("Hello") == string::npos && s.find("hello") == string::npos;}), EqualsContainer(vector<string> {"Goodbye World", "meow", "goodbye"})); } }; Describe(the_generic_vector_reduce_function) { It(should_correctly_reduce_an_int_vector_into_a_single_int) { Assert::That(vectorReduce(vector<int> {5, 7, 4, 86, 3, 3, 2, -23, 99}, [] (int s, int n) -> int {return s + n * n;}, 0), Equals(17838)); Assert::That(vectorReduce(vector<int> {5, 7, 4, 86, 3, 3, 2, -23, 99}, [] (int t, int n) -> int {return t < n ? n : t;}, INT_MIN), Equals(99)); Assert::That(vectorReduce(vector<int> {5, 7, 4, 86, 3, 3, 2, -23, 99}, [] (int t, int n) -> int {return t > n ? n : t;}, INT_MAX), Equals(-23)); } It(should_correctly_reduce_an_int_vector_into_a_string) { Assert::That(vectorReduce(vector<int> {5, 7, 4, 86, 3, 3, 2, -23, 99}, [] (string s, int n) -> string {return s + to_string(n);}, (string)""), Equals("57486332-2399")); } It(should_correctly_reduce_a_string_vector_to_an_int) { Assert::That(vectorReduce(vector<string> {"Hello World", "Goodbye World", "hello", "meow", "goodbye"}, [] (int n, string s) -> int {return n + s.length();}, 0), Equals(40)); } };
- #include <string>
- using namespace std;
- Describe(the_generic_vector_map_function) {
- It(should_correctly_map_an_int_vector_to_an_int_vector) {
Assert::That(vectorMap(vector<int> {2, -7, 5, -4, 3}, (function<int (int)>)([] (int n) -> int {return n * -2;})), EqualsContainer(vector<int> {-4, 14, -10, 8, -6}));- Assert::That(vectorMap(vector<int> {2, -7, 5, -4, 3}, [] (int n) -> int {return n * -2;}), EqualsContainer(vector<int> {-4, 14, -10, 8, -6}));
- }
- It(should_correctly_map_an_int_vector_to_a_string_vector) {
Assert::That(vectorMap(vector<int> {13, 27, -2, 33, 666, 11723}, (function<string (int)>)([] (int n) -> string {return to_string(n);})), EqualsContainer(vector<string> {"13", "27", "-2", "33", "666", "11723"}));- Assert::That(vectorMap(vector<int> {13, 27, -2, 33, 666, 11723}, [] (int n) -> string {return to_string(n);}), EqualsContainer(vector<string> {"13", "27", "-2", "33", "666", "11723"}));
- }
- };
- Describe(the_generic_vector_filter_function) {
- It(should_correctly_filter_an_int_vector) {
Assert::That(vectorFilter(vector<int> {4, 6, 9, 16, -5, -28}, (function<bool (int)>)([] (int n) -> bool {return n % 2 != 0;})), EqualsContainer(vector<int> {9, -5}));Assert::That(vectorFilter(vector<int> {4, 6, 9, 16, -5, -28}, (function<bool (int)>)([] (int n) -> bool {return n % 2 == 0;})), EqualsContainer(vector<int> {4, 6, 16, -28}));- Assert::That(vectorFilter(vector<int> {4, 6, 9, 16, -5, -28}, [] (int n) -> bool {return n % 2 != 0;}), EqualsContainer(vector<int> {9, -5}));
- Assert::That(vectorFilter(vector<int> {4, 6, 9, 16, -5, -28}, [] (int n) -> bool {return n % 2 == 0;}), EqualsContainer(vector<int> {4, 6, 16, -28}));
- }
- It(should_correctly_filter_a_string_vector) {
Assert::That(vectorFilter(vector<string> {"Hello World", "Goodbye World", "hello", "meow", "goodbye"}, (function<bool (string)>)([] (string s) -> bool {return s.find("Hello") != string::npos || s.find("hello") != string::npos;})), EqualsContainer(vector<string> {"Hello World", "hello"}));Assert::That(vectorFilter(vector<string> {"Hello World", "Goodbye World", "hello", "meow", "goodbye"}, (function<bool (string)>)([] (string s) -> bool {return s.find("Hello") == string::npos && s.find("hello") == string::npos;})), EqualsContainer(vector<string> {"Goodbye World", "meow", "goodbye"}));- Assert::That(vectorFilter(vector<string> {"Hello World", "Goodbye World", "hello", "meow", "goodbye"}, [] (string s) -> bool {return s.find("Hello") != string::npos || s.find("hello") != string::npos;}), EqualsContainer(vector<string> {"Hello World", "hello"}));
- Assert::That(vectorFilter(vector<string> {"Hello World", "Goodbye World", "hello", "meow", "goodbye"}, [] (string s) -> bool {return s.find("Hello") == string::npos && s.find("hello") == string::npos;}), EqualsContainer(vector<string> {"Goodbye World", "meow", "goodbye"}));
- }
- };
- Describe(the_generic_vector_reduce_function) {
- It(should_correctly_reduce_an_int_vector_into_a_single_int) {
Assert::That(vectorReduce(vector<int> {5, 7, 4, 86, 3, 3, 2, -23, 99}, (function<int (int, int)>)([] (int s, int n) -> int {return s + n * n;}), 0), Equals(17838));Assert::That(vectorReduce(vector<int> {5, 7, 4, 86, 3, 3, 2, -23, 99}, (function<int (int, int)>)([] (int t, int n) -> int {return t < n ? n : t;}), INT_MIN), Equals(99));Assert::That(vectorReduce(vector<int> {5, 7, 4, 86, 3, 3, 2, -23, 99}, (function<int (int, int)>)([] (int t, int n) -> int {return t > n ? n : t;}), INT_MAX), Equals(-23));- Assert::That(vectorReduce(vector<int> {5, 7, 4, 86, 3, 3, 2, -23, 99}, [] (int s, int n) -> int {return s + n * n;}, 0), Equals(17838));
- Assert::That(vectorReduce(vector<int> {5, 7, 4, 86, 3, 3, 2, -23, 99}, [] (int t, int n) -> int {return t < n ? n : t;}, INT_MIN), Equals(99));
- Assert::That(vectorReduce(vector<int> {5, 7, 4, 86, 3, 3, 2, -23, 99}, [] (int t, int n) -> int {return t > n ? n : t;}, INT_MAX), Equals(-23));
- }
- It(should_correctly_reduce_an_int_vector_into_a_string) {
Assert::That(vectorReduce(vector<int> {5, 7, 4, 86, 3, 3, 2, -23, 99}, (function<string (string, int)>)([] (string s, int n) -> string {return s + to_string(n);}), (string)""), Equals("57486332-2399"));- Assert::That(vectorReduce(vector<int> {5, 7, 4, 86, 3, 3, 2, -23, 99}, [] (string s, int n) -> string {return s + to_string(n);}, (string)""), Equals("57486332-2399"));
- }
- It(should_correctly_reduce_a_string_vector_to_an_int) {
Assert::That(vectorReduce(vector<string> {"Hello World", "Goodbye World", "hello", "meow", "goodbye"}, (function<int (int, string)>)([] (int n, string s) -> int {return n + s.length();}), 0), Equals(40));- Assert::That(vectorReduce(vector<string> {"Hello World", "Goodbye World", "hello", "meow", "goodbye"}, [] (int n, string s) -> int {return n + s.length();}, 0), Equals(40));
- }
- };
class Stack { // Just to hide the use of array implementation constructor() { this._items = []; } push(data) { this._items.push(data); } pop() { return this._items.pop(); } get length() { return this._items.length; } } class Queue { constructor() { this._stack = new Stack(); } enqueue(data) { this._stack.push(data); } dequeue() { if (this._stack.length === 1) return this._stack.pop(); else { var tmp = this._stack.pop(), result = this.dequeue(); this.enqueue(tmp); return result; } } }
- class Stack { // Just to hide the use of array implementation
- constructor() {
- this._items = [];
- }
- push(data) {
- this._items.push(data);
- }
- pop() {
- return this._items.pop();
- }
length() {- get length() {
- return this._items.length;
- }
- }
- class Queue {
- constructor() {
- this._stack = new Stack();
- }
- enqueue(data) {
- this._stack.push(data);
- }
- dequeue() {
if (this._stack.length() === 1)- if (this._stack.length === 1)
- return this._stack.pop();
- else {
- var tmp = this._stack.pop(), result = this.dequeue();
- this.enqueue(tmp);
- return result;
- }
- }
- }
Test.describe("Queue", function () { Test.it("is first-in-first-out", function () { var queue = new Queue(); let items = [1,2,3]; items.forEach(item => queue.enqueue(item)); Test.assertEquals(queue.dequeue(), 1); Test.assertEquals(queue.dequeue(), 2); Test.assertEquals(queue.dequeue(), 3); }); Test.describe("#enqueue", function() { Test.it("adds the item to the stack", function () { var queue = new Queue(); var mockStack = []; queue._stack = mockStack; queue.enqueue(1); Test.assertSimilar(mockStack, [1]); queue.enqueue(2); Test.assertSimilar(mockStack, [1,2]); }); }); Test.describe("#dequeue", function() { Test.it("removes items from the stack", function () { var queue = new Queue(); var mockStack = [1,2]; queue._stack = mockStack; queue.dequeue(); Test.assertSimilar(mockStack, [2]); queue.dequeue(); Test.assertSimilar(mockStack, []); }); Test.it("returns the first item from the stack", function () { var queue = new Queue(); var mockStack = [1,2]; var result = null; queue._stack = mockStack; result = queue.dequeue(); Test.assertEquals(result, 1); result = queue.dequeue(); Test.assertEquals(result, 2); }); }); }); Test.describe("Stack", function () { let stack = new Stack(); Test.it("has #pop", function () { Test.expect(typeof stack.pop === "function"); }); Test.it("has #push", function () { Test.expect(typeof stack.push === "function"); }); Test.it("has .length", function () { Test.expect(typeof stack.length === "number"); }); Test.it("does not have #shift", function () { Test.expect(typeof stack.shift === "undefined"); }); });
- Test.describe("Queue", function () {
Test.it("should have working enqueue and dequeue operations", function () {- Test.it("is first-in-first-out", function () {
- var queue = new Queue();
queue.enqueue(1);queue.enqueue(2);queue.enqueue(3);- let items = [1,2,3];
- items.forEach(item => queue.enqueue(item));
- Test.assertEquals(queue.dequeue(), 1);
queue.enqueue(4);queue.enqueue(5);queue.enqueue(6);- Test.assertEquals(queue.dequeue(), 2);
- Test.assertEquals(queue.dequeue(), 3);
queue.enqueue(7);queue.enqueue(8);queue.enqueue(9);queue.enqueue(10);Test.assertEquals(queue.dequeue(), 4);Test.assertEquals(queue.dequeue(), 5);Test.assertEquals(queue.dequeue(), 6);Test.assertEquals(queue.dequeue(), 7);Test.assertEquals(queue.dequeue(), 8);Test.assertEquals(queue.dequeue(), 9);Test.assertEquals(queue.dequeue(), 10);- });
- Test.describe("#enqueue", function() {
- Test.it("adds the item to the stack", function () {
- var queue = new Queue();
- var mockStack = [];
- queue._stack = mockStack;
- queue.enqueue(1);
- Test.assertSimilar(mockStack, [1]);
- queue.enqueue(2);
- Test.assertSimilar(mockStack, [1,2]);
- });
- });
- Test.describe("#dequeue", function() {
- Test.it("removes items from the stack", function () {
- var queue = new Queue();
- var mockStack = [1,2];
- queue._stack = mockStack;
- queue.dequeue();
- Test.assertSimilar(mockStack, [2]);
- queue.dequeue();
- Test.assertSimilar(mockStack, []);
- });
- Test.it("returns the first item from the stack", function () {
- var queue = new Queue();
- var mockStack = [1,2];
- var result = null;
- queue._stack = mockStack;
- result = queue.dequeue();
- Test.assertEquals(result, 1);
- result = queue.dequeue();
- Test.assertEquals(result, 2);
- });
- });
- });
- Test.describe("Stack", function () {
- let stack = new Stack();
- Test.it("has #pop", function () {
- Test.expect(typeof stack.pop === "function");
- });
- Test.it("has #push", function () {
- Test.expect(typeof stack.push === "function");
- });
- Test.it("has .length", function () {
- Test.expect(typeof stack.length === "number");
- });
- Test.it("does not have #shift", function () {
- Test.expect(typeof stack.shift === "undefined");
- });
- });
A structure to allow new languages to be added.
// Declare new languages here and map them in parseGreeting() function const GREET_LANG = { ENGLISH: 0, PIRATE: 1, BINARY: 2 } function numberToBinaryArray(number) { let result = []; while(number > 0){ let bit = Math.floor(number % 2) != 0 ? 1 : 0; result.unshift(bit) number = Math.floor(number / 2); } while(result.length != 8) result.unshift(0); return result; } function txtToBin(text) { let result = []; for(let character of text){ let binaryArr = numberToBinaryArray(character.charCodeAt()); result = result.concat(binaryArr); } return result.join(""); } function parseGreeting(lang) { switch(lang){ case GREET_LANG.PIRATE: return 'yar'; case GREET_LANG.BINARY: return txtToBin('hello'); default: return 'hello'; } } const parseWhoever = (whoever, lang) => lang == GREET_LANG.BINARY ? txtToBin(whoever) : whoever; const hello = (whoever, lang=GREET_LANG.ENGLISH) => `${parseGreeting(lang)} ${parseWhoever(whoever, lang)}`;
var numberToBinaryArray = (number) => {var result = [];- // Declare new languages here and map them in parseGreeting() function
- const GREET_LANG = {
- ENGLISH: 0,
- PIRATE: 1,
- BINARY: 2
- }
- function numberToBinaryArray(number) {
- let result = [];
- while(number > 0){
var bit = Math.floor(number % 2) != 0 ? 1 : 0;- let bit = Math.floor(number % 2) != 0 ? 1 : 0;
- result.unshift(bit)
- number = Math.floor(number / 2);
- }
- while(result.length != 8)
- result.unshift(0);
- return result;
- }
var txtToBin = (text) => {var result = [];for(var i = 0; i < text.length; i++){var binaryArr = numberToBinaryArray(text.charCodeAt(i));- function txtToBin(text) {
- let result = [];
- for(let character of text){
- let binaryArr = numberToBinaryArray(character.charCodeAt());
- result = result.concat(binaryArr);
- }
- return result.join("");
- }
let helloLangs = {english: "hello",pirate: "yar",binary: txtToBin('hello')- function parseGreeting(lang) {
- switch(lang){
- case GREET_LANG.PIRATE:
- return 'yar';
- case GREET_LANG.BINARY:
- return txtToBin('hello');
- default:
- return 'hello';
- }
- }
const hello = (whoever, lang="english") => `${helloLangs[lang]} ${lang == 'binary' ? txtToBin(whoever) : whoever}`;- const parseWhoever = (whoever, lang) => lang == GREET_LANG.BINARY ? txtToBin(whoever) : whoever;
- const hello = (whoever, lang=GREET_LANG.ENGLISH) => `${parseGreeting(lang)} ${parseWhoever(whoever, lang)}`;
describe("Solution", function(){ it("defaults to english", function(){ Test.assertEquals(hello('gotham'), "hello gotham"); }); it("responds in pirate when passed 'pirate' as the language", function(){ Test.assertEquals(hello('gotham', GREET_LANG.PIRATE), "yar gotham"); }); it("responds in real time binarry when passed 'binary' as the language", function(){ Test.assertEquals(hello('gotham', GREET_LANG.BINARY), "0110100001100101011011000110110001101111 011001110110111101110100011010000110000101101101"); }); });
- describe("Solution", function(){
- it("defaults to english", function(){
- Test.assertEquals(hello('gotham'), "hello gotham");
- });
- it("responds in pirate when passed 'pirate' as the language", function(){
Test.assertEquals(hello('gotham', 'pirate'), "yar gotham");- Test.assertEquals(hello('gotham', GREET_LANG.PIRATE), "yar gotham");
- });
- it("responds in real time binarry when passed 'binary' as the language", function(){
Test.assertEquals(hello('gotham', 'binary'), "0110100001100101011011000110110001101111 011001110110111101110100011010000110000101101101");- Test.assertEquals(hello('gotham', GREET_LANG.BINARY), "0110100001100101011011000110110001101111 011001110110111101110100011010000110000101101101");
- });
- });