7 kyu

Caffeine Script

3,509 of 9,847mcclaskc
Description
Loading description...
Fundamentals
Strings
  • Please sign in or sign up to leave a comment.
  • sylentwulf81 Avatar

    This comment has been hidden.

  • guiller64 Avatar

    expect(caffeineBuzz(4)).to.equal("mocha_missing!")? 4%4=0 then expect Coffee

  • Kasimonsan Avatar

    // This JavaScript sample tests may help you getting started:

    const { expect } = require("chai");

    describe('Example tests', () => {

    it("returns correct values", () => {

    expect(caffeineBuzz(1)).to.equal("mocha_missing!");
    expect(caffeineBuzz(2)).to.equal("mocha_missing!");
    expect(caffeineBuzz(3)).to.equal("Java");
    expect(caffeineBuzz(4)).to.equal("mocha_missing!");
    expect(caffeineBuzz(5)).to.equal("mocha_missing!");
    expect(caffeineBuzz(6)).to.equal("JavaScript");
    expect(caffeineBuzz(7)).to.equal("mocha_missing!");
    expect(caffeineBuzz(8)).to.equal("mocha_missing!");
    expect(caffeineBuzz(9)).to.equal("Java");
    expect(caffeineBuzz(10)).to.equal("mocha_missing!");
    expect(caffeineBuzz(11)).to.equal("mocha_missing!");
    expect(caffeineBuzz(12)).to.equal("CoffeeScript");
    

    });

    });

  • Polymorbism Avatar

    Javascript needs random tests so that This doesn't work.

  • laurelis24 Avatar

    I spent too much time on this one. xD

  • user9644768 Avatar

    Ruby 3.0 should be enabled.

  • ejini战神 Avatar

    No sample tests and random tests in

    • Coffeescript
    • Java
    • Javascript
  • wani Avatar

    This Kata asks for something different than what it tests for.

    Not fun :(

  • filipeqm17 Avatar

    I get the right result on my console, but the test doesn't go through...

  • user4896126 Avatar

    disappointing and poorly written deciphering english rather than solving katas

  • ThePyIsNigh Avatar

    test wasn't working. Response received but no data was written to STDOUT or STDERR.

    But it did let me attempt to solve and those tests worked.

  • Haksell Avatar

    Python version should use snake_case.

  • mentalplex Avatar

    No python sample test cases

  • interdigitizer Avatar

    I am having a problem with the tests in JavaScript. I keep receiving an error that no tests were provided preventing solution submission...any insight on why the tests below are not working?

    Test.assertEquals(caffeineBuzz(1), "mocha_missing!");
    Test.assertEquals(caffeineBuzz(3), "Java");
    Test.assertEquals(caffeineBuzz(6), "JavaScript");
    Test.assertEquals(caffeineBuzz(12), "CoffeeScript");
    
  • user4651353 Avatar

    Hey guys, can someone help me with the "If the integer is one of the above and is even, add "Script" to the end of the string" part ? Don't really understand it.

  • sirjudge Avatar

    I have the following test cases that all pass in java

    assertEquals("mocha_missing",CaffeineBuzz.caffeineBuzz(1)); assertEquals("JavaScript",CaffeineBuzz.caffeineBuzz(6)); assertEquals("CoffeeScript",CaffeineBuzz.caffeineBuzz(12)); assertEquals("CoffeeScript",CaffeineBuzz.caffeineBuzz(-12));

    however when I go to submit I get the following in the output

    test_caffeineBuzz(CaffeineBuzz_Test) expected: but was:

    Any ideas on what to do?

    EDIT: I added assertEquals("mocha_missing",CaffeineBuzz.caffeineBuzz(13)); and assertEquals("mocha_missing",CaffeineBuzz.caffeineBuzz(67)); both tests return true

  • JKDos Avatar

    This comment has been hidden.

  • PerkOne Avatar

    I have problem too doing in Java. I thought i made mistake in my code and i unlocked solution. Then i copy/paste several solutions too see how i have to do but i get error massage again. What do i have to type in "Your Test Cases:"? I entered: 1 3 6 12

  • SirensR4ever Avatar

    I keep getting the error: Expected: mocha_missing!, instead got: mocha_missing!Script when all the tests pass.. Test.assertEquals("JavaScript", caffeineBuzz(6)); Test.assertEquals("mocha_missing!", caffeineBuzz(67)); Test.assertEquals("Java", caffeineBuzz(3)); Test.assertEquals("mocha_missing!", caffeineBuzz(1)); Test.assertEquals("CoffeeScript", caffeineBuzz(12));

    I've passed this in Python but it won't go through for JS

  • goldthelocks Avatar

    Seems this kata is missing its test case.

    "Where test case go?"

  • gttotev Avatar

    Java needs some example tests ☺.

  • gomesalexandre Avatar

    I'm having "Expected: CoffeeScript, instead got: JavaScript".

    Any ideas ?

  • donaldsebleung Avatar

    Could have included random tests if test cases could still be edited. Keep that in mind when making future Kata :)

  • san00 Avatar

    Hello, Can anyone explain what the test cases are for, why they are needed and how to use them please.

  • jsandlund Avatar

    This comment has been hidden.

  • Joz Avatar

    expected: but was:

    same mistake as 5 month ago.. It's still here?

  • AttoLee Avatar

    This comment has been hidden.

  • GiacomoSorbi Avatar

    Translated it into Ruby, if you wish to approve it :)

    Once done, let me know if you wish to add sample and random test cases to Python and JS versions too :)

  • hagnat Avatar

    missing python test cases

    test.assert_equals(caffeineBuzz(1), "mocha_missing!")
    test.assert_equals(caffeineBuzz(2), "mocha_missing!")
    test.assert_equals(caffeineBuzz(3), "Java")
    test.assert_equals(caffeineBuzz(4), "mocha_missing!")
    test.assert_equals(caffeineBuzz(5), "mocha_missing!")
    test.assert_equals(caffeineBuzz(6), "JavaScript")
    test.assert_equals(caffeineBuzz(7), "mocha_missing!")
    test.assert_equals(caffeineBuzz(8), "mocha_missing!")
    test.assert_equals(caffeineBuzz(9), "Java")
    test.assert_equals(caffeineBuzz(10), "mocha_missing!")
    test.assert_equals(caffeineBuzz(11), "mocha_missing!")
    test.assert_equals(caffeineBuzz(12), "CoffeeScript")
    
  • Stargator Avatar

    I'm passing the example test cases provided, but when I go to submit my solution it seems assertEquals in the Test Case is not being recognized.

    /CaffeineBuzz_Test.java:9: error: cannot find symbol assertEquals("mocha_missing!", CaffeineBuzz.caffeineBuzz(mochaMissingArgs[i])); ^ symbol: variable CaffeineBuzz location: class CaffeineBuzz_Test

  • BartoszKP Avatar

    "which takes a non-zero integer as it's one argument."

    should be "its". Possibly also "single" or "only" instead of "one".

  • SithFire Avatar

    This kata is broken?

  • niczm25 Avatar

    on my sourcecode i have this,

    if(number % 3 != 0) result = "mocha_missing!"; else result = "Java";

    but unfortunately this occur, on test case it means that number is divisible by 3 right but as you can see on my code it should return "Java" test_caffeineBuzz(CaffeineBuzz_Test) expected:<[Java]> but was:<[mocha_missing!]>

  • uohaetodev Avatar

    The test class area is empty and i'm not sure how to write the test class like the other katas. Any help?

  • idrey Avatar

    This comment has been hidden.

  • MrJcnby Avatar

    test_caffeineBuzz(CaffeineBuzz_Test) expected: but was:

    i'm don't understand, what solution need in this task? What int n need for : "expected: but was:" Thanks.

  • Cosineoftheta Avatar

    This comment has been hidden.

  • Shadowrunner05 Avatar

    tried myself and got the same error as anyone else here in the forum. since i want to get points, i didn't took a look at the solution. but what is the problem with the tests? my testcases are running perfectly well!

  • mcclaskc Avatar

    RE: expected: but was: (Java)

    Many of you have reported seeing this failed test message in the Java version of this kata. I have done a little bit of investigating, but I still do not know why it is happening. I am using junit's assertEquals to compare the two strings (the first being what is expected, and the second being what you return).

    assertEquals("CoffeeScript", CaffeineBuzz.caffeineBuzz(12));
    

    If the right does not equal the left, it prints out the empty error message and not the actual strings themselves, which is very frustrating. However, if I give it a literal string, it will print the desired error message:

    // test
    assertEquals("CoffeeScript", "derp");
    
    // output
    expected:<[CoffeeScript]> but was:<[derp]>
    

    Does anyone know why this is happening?

  • olkinn Avatar

    Hi, i also got an error like this. Can anybody please help out?

    test_caffeineBuzz(CaffeineBuzz_Test) mocha_missing! expected: but was: 0 Passed 1 Failed 0 Errors

    Process took 5200ms to complete

  • alex.budiakov Avatar

    Hi, I'm getting a weird test results, please check

    test_caffeineBuzz(CaffeineBuzz_Test)

    expected: but was:

    0 Passed

    1 Failed

    0 Errors

  • liry Avatar

    Having trouble submitting Java solution. Getting weird empty test result:

    test_caffeineBuzz(CaffeineBuzz_Test)
      expected: but was:
    

    When I add the debug output, the last call of my caffeineBuzz function before the error is with the n = 12.

  • Phillygav Avatar

    Having trouble with 1 test case expecting Javascript and apparently only getting Java.

  • Azuaron Avatar

    You need at least one negative test case that is even (e.g., 4).

  • user578387 Avatar

    I want to do a translation, but it seems so perfect as just the three caffeine languages together... such torment!