Translate from integers to words in a chosen language. E.g.
number_as_words(1028) => "one thousand and twenty eight"
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"
This exercise lends itself very well to Typescript with the concept of discriminated unions.
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.
Download dotnet SDK and Visual Studio Code.
dotnet new sln
(In a new empty directory)dotnet new classlib -o <project>
dotnet sln add <project>
dotnet new xunit -o <project>.Tests
dotnet sln add <project>.Tests
cd <project>.Tests
dotnet add reference ../<project>
dotnet watch test
Install NodeJs
npm init -y
(In a new empty directory)npm install --save-dev typescript jest ts-jest @types/jest prettier
npx tsc --init
npx ts-jest config:init
npm pkg set scripts.test="jest"
npm pkg set scripts.test:watch="jest --watchAll"
- Create
__tests__/<...>.test.ts
withdescribe("...", () => { it("...", () => {})})
npm run test:watch
Install NodeJs
npm init -y
(In a new empty directory)npm install --save-dev jest @types/jest prettier
npm pkg set scripts.test="jest"
- Create
__tests__/<...>.test.js
withdescribe("...", () => { it("...", () => {})})
npm run test -- --watch
Install Rust from https://www.rust-lang.org/learn/get-started
- Create project:
cargo init
(In a new empty directory) - Create a test file as tests/..._test.rs
- Run tests
cargo watch -x test