Skip to content

Instantly share code, notes, and snippets.

View franreyes's full-sized avatar

Fran Reyes franreyes

View GitHub Profile
@franreyes
franreyes / GildedRoseTest.php
Created November 27, 2023 18:41
GildedRoseTest.php
<?php
namespace tests;
use Codesai\TDD\GildedRose\GildedRose;
use Codesai\TDD\GildedRose\Item;
use PHPUnit\Framework\TestCase;
class GildedRoseTest extends TestCase
{
@franreyes
franreyes / GildedRoseTest.cs
Last active February 23, 2023 11:33
TDD Gilded Rose Kata test solution
using Xunit;
namespace Gilded_rose.Test
{
public class GildedRoseTest
{
private const int MinQuality = 0;
private const int MaxQuality = 50;
[Fact]
@franreyes
franreyes / shop.test.js
Created December 12, 2022 16:54
TDD Gilde Rose Kata in JS
import Shop from "./Shop";
import Item from "./Item";
const MIN_QUALITY = 0;
const MAX_QUALITY = 50;
test("regular items' quality decreases every day", () => {
const item = regularItem(1, 3);
const shop = new Shop([item]);
import {Shop} from '../src/Shop';
import {Item} from "../src/Item";
describe('Gilded Rose', () => {
const MIN_QUALITY = 0;
const MAX_QUALITY = 50;
it("regular items' quality decreases every day", () => {
const item = regularItem(1, 3);
public class PageIndexer {
PageIndexation calculate(PageIndexation currentPageIndexation, Search search) {
...
}
}
@franreyes
franreyes / IndexationAndCalculator.java
Created September 12, 2022 15:20
IndexationAndCalculator.java
public interface IndexationCalculator {
PageIndexation update(PageIndexation currentPageIndexation, Search search);
}
public interface CanonicalCalculator {
PageIndexation update(PageIndexation currentPageIndexation, Search search);
}
public class PageIndexation{
public bool isIndexed;
@franreyes
franreyes / GildedRoseTest.java
Last active February 23, 2023 11:45
Full coverage and mutants killed in GildedRose.java
package com.gildedrose;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
public class GildedRoseTest {
private static final int MIN_QUALITY = 0;
@franreyes
franreyes / spec_test_update_quality.sql
Last active July 15, 2019 09:48
gilded_rose_plsql_test_update_quality
CREATE OR REPLACE PACKAGE test_update_quality
IS
--%suite(Update quality)
--%beforeeach
PROCEDURE setup;
--%test(sell in decreases every day)
PROCEDURE sell_in_decreases_every_day;
Exchange bank= new Exchange().
bank.addRate("USD", "GBP", STANDARD_RATE);
bank.commission(STANDARD_COMMISSION);
Money result= bank.convert(new Note(100, "USD"), "GBP");
assertEquals(new Note(49.25, "GBP"), result);
-----
Exchange bank= new Exchange().
bank.addRate("USD", "GBP", 2);