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.
Gunnar Behlvs.JohanWiltink2 months ago
Multiply
hehe
Gunnar Behlvs.Racketfew2 months ago
Make It Greater Than 2
we never needed a function.
import codewars_test as test # TODO Write tests import solution # or from solution import example # test.assert_equals(actual, expected, [optional] message) .describe("Example") def test_group(): .it("test case") def test_case(): test.assert_equals(True, True) test.assert_equals(True, True) test.assert_equals(True, True) test.assert_equals(True, True) test.assert_equals(True, True) test.assert_equals(True, True)
- import codewars_test as test
- # TODO Write tests
- import solution # or from solution import example
- # test.assert_equals(actual, expected, [optional] message)
- @test.describe("Example")
- def test_group():
- @test.it("test case")
- def test_case():
test.assert_equals(a(0), True)test.assert_equals(a(1), True)test.assert_equals(a(2), True)test.assert_equals(a(3), True)test.assert_equals(a(4), True)test.assert_equals(a(5), True)- test.assert_equals(True, True)
- test.assert_equals(True, True)
- test.assert_equals(True, True)
- test.assert_equals(True, True)
- test.assert_equals(True, True)
- test.assert_equals(True, True)
// Since Node 10, we're using Mocha. // You can use 'chai' for assertions. const chai = require ("chai"); const assert = chai.assert; // Uncoment the following line to disable truncatting failure message dor deep equals, do: // chai.config.truncateThreshold = 0; // Since Node 12, we no longer include assertions from our department custom test frameworks by default // Uncoment the following to use the old assetions: // const Test = require ("@codewars/test-compat"); describe("solution", function() { it ("should test for something", function () { // Test assetrtEquals(1+1+2); // assert.strictEqual(1+1+2); }); });
// Since Node 10, we're using Mocha. // You can use `chai` for assertions. const chai = require("chai"); const assert = chai.assert; // Uncomment the following line to disable truncating failure messages for deep equals, do: // chai.config.truncateThreshold = 0; // Since Node 12, we no longer include assertions from our deprecated custom test framework by default. // Uncomment the following to use the old assertions: // const Test = require("@codewars/test-compat"); describe("Solution", function() { it("should test for something", function() { // Test.assertEquals(1 + 1, 2); // assert.strictEqual(1 + 1, 2); }); });
m=(a,b)->a*b+1 {:m}
-- Moonscript!multiply_and_add_one = (a, b) -> a * b + 1{ :multiply_and_add_one }- m=(a,b)->a*b+1
- {:m}
--[=[ import m from require "moon_solution" describe "Multiply and Add One Tests", -> it "Basic tests", -> assert.are.same m(2,3),7 assert.are.same m(4,5),21 assert.are.same m(0,10),1 assert.are.same m(-1,5),-4 --]=] require "setup"
- --[=[
import multiply_and_add_one from require "moon_solution"- import m from require "moon_solution"
- describe "Multiply and Add One Tests", ->
- it "Basic tests", ->
assert.are.same multiply_and_add_one(2, 3), 7assert.are.same multiply_and_add_one(4, 5), 21assert.are.same multiply_and_add_one(0, 10), 1assert.are.same multiply_and_add_one(-1, 5), -4- assert.are.same m(2,3),7
- assert.are.same m(4,5),21
- assert.are.same m(0,10),1
- assert.are.same m(-1,5),-4
- --]=] require "setup"
Lists
void re_arrange(std::vector<int>& data) { std::sort(data.begin(), data.end(), [](int x, int y) { return std::make_pair(x % 2 != 0, x) < std::make_pair(y % 2 != 0, y); }); }
- #include <vector>
- void re_arrange(std::vector<int>& data) {
auto it = std::partition(data.begin(), data.end(), [](int x) { return x % 2 == 0; });std::sort(data.begin(), it);std::sort(it, data.end());- std::sort(data.begin(), data.end(), [](int x, int y) { return std::make_pair(x % 2 != 0, x) < std::make_pair(y % 2 != 0, y); });
- }
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; class SolutionTest { ("testCases") public void expectedValueForTestCase(String inputName, String expectedOutputValue) { assertThat(greet.greet(inputName)) .as("It should return the expected value for %s", inputName) .isEqualTo(expectedOutputValue); } public static Stream<Arguments> testCases() { return Stream.of( Arguments.of("Reemu", "hello my name is Reemu"), Arguments.of("Pepo", "hello my name is Pepo"), Arguments.of("Delacroix", "hello my name is Delacroix"), Arguments.of("Toto", "hello my name is Toto") ); } private final Greet greet = new Greet(); }
- import org.junit.jupiter.params.ParameterizedTest;
- import org.junit.jupiter.params.provider.Arguments;
- import org.junit.jupiter.params.provider.MethodSource;
- import java.util.stream.Stream;
- import static org.assertj.core.api.Assertions.assertThat;
- class SolutionTest {
- @ParameterizedTest
- @MethodSource("testCases")
public void it_should_return_the_expected_value_for_test_case(String inputName, String expectedOutputValue) {- public void expectedValueForTestCase(String inputName, String expectedOutputValue) {
- assertThat(greet.greet(inputName))
- .as("It should return the expected value for %s", inputName)
- .isEqualTo(expectedOutputValue);
- }
- public static Stream<Arguments> testCases() {
- return Stream.of(
- Arguments.of("Reemu", "hello my name is Reemu"),
- Arguments.of("Pepo", "hello my name is Pepo"),
- Arguments.of("Delacroix", "hello my name is Delacroix"),
- Arguments.of("Toto", "hello my name is Toto")
- );
- }
- private final Greet greet = new Greet();
- }