Skip to content

Instantly share code, notes, and snippets.

Modified Text Processing kata

As a developer that writes blog posts I want a tool that helps me to understand better the text I am writing. For that I need a way to know the following:

  1. What are the most common words used in the text?

  2. How many characters does the text have?

Passing a text through the command line the programa should show the results on the console.

Modified Text Processing kata

As a developer that writes blog posts I want a tool that helps me to understand better the text I am writing. For that I need a way to know the following:

  1. What are the most common words used in the text?

  2. How many characters does the text have?

Passing a text through the command line the programa should show the results on the console.

Next iteration - Extra hot.

The machine has been upgraded and the drink maker is now able to make orange juice and to deliver extra hot drinks. You have to update your code to send the correct messages to the drink maker so that users can have orange juices or extra hot drinks.

Let us see if your implementation is flexible enough to welcome those changes with not too much hassle.

Use cases

Next iteration - Going into business.

The coffee machine is not free anymore! One tea is 0,4 euro, a coffee is 0,6 euro, a chocolate is 0,5 euro.

The drink maker will now only make a drink if enough money is given for it.

Use cases

  • The drink maker should make the drinks only if the correct amount of money is given.
  • If not enough money is provided, we want to send a message to the drink maker. The message should contains at least the amount of money missing.
@trikitrok
trikitrok / ArgentRoseStoreTest.cs
Created May 9, 2025 11:58
Argent Rose super lite tests with 100% coverage but some mutants surviving no Wine
using NUnit.Framework;
namespace ArgentRose.Tests;
public class ArgentRoseStoreTest
{
private const int MIN_QUALITY = 0;
private const int MAX_QUALITY = 50;
private const int SELLIN_LAST_DAY = 0;
private const int EXPIRED = -1;
@trikitrok
trikitrok / ExcludeFilesTest.cs
Created April 4, 2025 09:14
First possible test for legacy-wav-report exercise
public class ExcludeFilesTest
{
[Test]
public void Exclude_File_With_Keyword()
{
var wavExtractor = Substitute.For<WavExtractor32V>();
var excludeFiles = new ExcludeFiles(wavExtractor);
var filenames = new List<string>()
{
@trikitrok
trikitrok / long-legacy-argent-rose.ts
Last active April 3, 2025 18:37
legacy argent rose code including Lanzarote Wine
export class ArgentRoseStore
// ...
private updateQuality(product: Product): void {
if (product.isTheatrePasses()) {
if (product.sellIn < 0) {
product.dropQualityToMinimum();
} else if (product.sellIn < 5) {
product.increaseQualityBy(3);
} else {
@trikitrok
trikitrok / Alarm.test.ts
Created March 28, 2025 16:19
No mutants surviving (legacy version)
import {Alarm} from "../src/Alarm";
describe("Alarm", () => {
const lowestSafePressure: number = 17;
const highestSafePressure: number = 21;
const tooLowPressure: number = lowestSafePressure - 1;
const tooHighPressure: number = highestSafePressure + 1;
let alarm: AlarmForTesting;
it("activates when sampled pressure is too low", () => {
@trikitrok
trikitrok / ArgentRoseStore.test.ts
Created March 28, 2025 13:25
Legacy Argent Rose tests with no mutants alive
import {ArgentRoseStore} from "../src/ArgentRoseStore";
import {Product} from "../src/Product";
describe("ArgentRoseStore", () => {
it("Regular Product decreases quality by two", async () => {
const store = storeIncluding(regularProduct(1, 10));
await store.update();
expect(store.getSavedInventory()).toEqual(inventoryIncluding(regularProduct(0, 8)));
@trikitrok
trikitrok / ArgentRoseStore.test.ts
Created March 28, 2025 13:15
Legacy Argent Rose tests with no mutants alive but not covering the loop
import {ArgentRoseStore} from "../src/ArgentRoseStore";
import {Product} from "../src/Product";
describe("ArgentRoseStore", () => {
it("Regular Product decreases quality by two", async () => {
const store = storeIncluding(regularProduct(1, 10));
await store.update();
expect(store.getSavedInventory()).toEqual(inventoryIncluding(regularProduct(0, 8)));