Skip to content

Instantly share code, notes, and snippets.

@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)));
@trikitrok
trikitrok / ArgentRoseStore.test.ts
Created March 28, 2025 13:00
Legacy Argent Rose tests with 100% coverage but some mutants still 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(5, 10));
await store.update();
expect(store.getSavedInventory()).toEqual(inventoryIncluding(regularProduct(4, 8)));
@trikitrok
trikitrok / ArgentRoseStore.test.ts
Created March 28, 2025 12:39
Legacy Argent Rose tests with 100% coverage but many mutants still 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 / game.test.ts
Last active April 8, 2025 16:47
Tests for modified ugly trivia with no relevant mutant surviving
import {Game} from "../src/game";
describe('Ugly trivia', () => {
it('simulation with 5 players', () => {
const rollNumbers = [
3, 6, 1, 6, 4, 5, 3, 2,
3, 4, 1, 5, 1, 5, 6, 3,
3, 5, 5, 3, 5, 3, 4, 2,
1, 4, 4, 5
];
public class ConjugatedGradient {
private readonly double tolerance;
private readonly int maxIterations;
public ConjugatedGradient(double tolerance = 1e-6, int maxIterations = 1000) {
this.tolerance = tolerance;
this.maxIterations = maxIterations;
}
public double[] Minimize(