Skip to content
/ kata Public

Coding exercises and demonstrations of test-driven development and pair programming

Notifications You must be signed in to change notification settings

jhannes/kata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 

Repository files navigation

Coding exercises for practicing programming skills

Number as words

Translate from integers to words in a chosen language. E.g. number_as_words(1028) => "one thousand and twenty eight"

C#

Rust

Translate messages

Translate messages with different arguments to different user languages. E.g. showMessage(english, { code: "illegalEmail", email: "foo-at-bar.com" }) should return "The email address foo-at-bar.com is formatted invalid"

Typescript

This exercise lends itself very well to Typescript with the concept of discriminated unions.

Minesweeper

Based on the simple computer game minesweeper. Given a field with mines placed, calculate the hints to show players.

This exercise requires some data structures, looping and conditional logic without conceptual complexity.

Java

C#

Starting points

C# with dotnet core

Download dotnet SDK and Visual Studio Code.

  1. dotnet new sln (In a new empty directory)
  2. dotnet new classlib -o <project>
  3. dotnet sln add <project>
  4. dotnet new xunit -o <project>.Tests
  5. dotnet sln add <project>.Tests
  6. cd <project>.Tests
  7. dotnet add reference ../<project>
  8. dotnet watch test

Jest with Typescript

Install NodeJs

  1. npm init -y (In a new empty directory)
  2. npm install --save-dev typescript jest ts-jest @types/jest prettier
  3. npx tsc --init
  4. npx ts-jest config:init
  5. npm pkg set scripts.test="jest"
  6. npm pkg set scripts.test:watch="jest --watchAll"
  7. Create __tests__/<...>.test.ts with describe("...", () => { it("...", () => {})})
  8. npm run test:watch

Jest with JavaScript

Install NodeJs

  1. npm init -y (In a new empty directory)
  2. npm install --save-dev jest @types/jest prettier
  3. npm pkg set scripts.test="jest"
  4. Create __tests__/<...>.test.js with describe("...", () => { it("...", () => {})})
  5. npm run test -- --watch

Rust

Install Rust from https://www.rust-lang.org/learn/get-started

  1. Create project: cargo init (In a new empty directory)
  2. Create a test file as tests/..._test.rs
  3. Run tests cargo watch -x test

About

Coding exercises and demonstrations of test-driven development and pair programming

Topics

Resources

Stars

Watchers

Forks