Ad
  • Custom User Avatar

    This kata doesn't appear to have any tests in JavaScript, so here's a testbed with both example tests and random tests:

    const chai = require("chai");
    const assert = require('chai').assert;
    
    describe('Example tests', () => {
        it('should return "Java" when number is divisible by 3 (e.g., 9)', () => {
            assert.strictEqual(caffeineBuzz(9), "Java");
        });
    
        it('should return "CoffeeScript" when number is divisible by both 3 and 4 (e.g., 12)', () => {
            assert.strictEqual(caffeineBuzz(12), "CoffeeScript");
        });
    
        it('should return "mocha_missing!" when number is not divisible by 3 or 4 (e.g., 7)', () => {
            assert.strictEqual(caffeineBuzz(7), "mocha_missing!");
        });
    });
    
    describe('Random tests', () => {
        // Generate 20 random tests
        for(let i = 0; i < 20; i++) {
            // Random number between 1 and 100
            const n = Math.floor(Math.random() * 100) + 1;
            
            // Calculate expected result
            let expected = "mocha_missing!";
            
            if (n % 3 === 0 && n % 4 === 0) {
                expected = "Coffee";
            } else if (n % 3 === 0) {
                expected = "Java";
            }
            
            if ((n % 3 === 0) && (n % 2 === 0)) {
                expected += "Script";
            }
            
            // Run the test 
            it(`Testing for n = ${n}`, () => {
                assert.strictEqual(caffeineBuzz(n), expected);
            });
        }
    });
    
  • Custom User Avatar
  • Custom User Avatar

    C#: method name should be PascalCase (Please refer to implementation of backward compatibility here )

  • Custom User Avatar

    C#: method name should be PascalCase (Please refer to implementation of backward compatibility here )

  • Custom User Avatar

    I've improved the java tests including the addition of random tests if anyone wants to approve it: https://www.codewars.com/kumite/638f44ccbb8c010058658dc8?sel=638f44ccbb8c010058658dc8

  • Custom User Avatar
  • Custom User Avatar

    Ruby 3.0 should be enabled, check details here and here.

    And if possible update the github list.

  • Custom User Avatar

    No random tests in

    • C#
    • Clojure
  • Custom User Avatar

    No sample tests and random tests in

    • Coffeescript
    • Java
    • Javascript
  • Custom User Avatar

    C# random tests are failing with some weird input. I got the same input twice and expected result differs somehow. An example what is passed inside a method: "3135 5400 3656889".

    Though some logs in console show "[3, 1, 3, 5, 5, 4, 0, 0, 3, 6, 5, 6]"

    As much as three times the same input can be passed into a method, with two times passing and failing on a third time

  • Custom User Avatar

    Missing random tests in multiple languages (python, ruby, java, js, ...)

  • Custom User Avatar

    The C# version is almost always throwing an error every time when just returning false and running all tests. It appears to be some issue with the "Random Tests".

    Random Tests: System.OutOfMemoryException : Out of memory
    STDERR: Stack overflow in unmanaged: IP: 0x5d208c, fault addr: 0x7ff0b2bf9ff8

    Code:
    public class solution
    {
    public bool validate(string n)
    {
    return false;
    }
    }

  • Custom User Avatar

    The C# test cases (example and hidden ones) are wrong.
    E.g. for the randomized "110 021 32667" it should return valid, but the test case expects invalid (check here: https://planetcalc.com/2464/)

    Same for those example test cases...

    The test cases also use the wrong C# order of parameters for AreEqual. And there are two that are exactly the same just pasted after one another..

    This (or at least the C# version of it) is a very low effort kata :/ Whoever translated it: shame on you

  • Custom User Avatar

    I am a bit confused on submitting a solution using Test Driven Development.

    I have used a list of credit card numbers from https://en.wikipedia.org/wiki/Luhn_algorithm, and have validated them with my code and they all pass accordingly.

    Invalid: 79927398710, 79927398711, 79927398712, 79927398714, 79927398715, 79927398716, 79927398717, 79927398718, 79927398719
    Valid: 79927398713

    How can I go about implementing this in TDD form?

    I currently have:
    Test.assertEquals(validatecard("79927398713"), true);
    Test.assertEquals(validatecard("79927398710"), false);