Delete go directory

This commit is contained in:
Matt Decker 2022-06-26 09:16:02 -05:00 committed by GitHub
parent 27a7ceb3c3
commit aa5356588b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 0 additions and 147 deletions

View File

@ -1,21 +0,0 @@
# GO Starter
- Run :
```shell
go run texttest_fixture.go [<number-of-days>; default: 2]
```
- Run tests :
```shell
go test ./...
```
- Run tests and coverage :
```shell
go test ./... -coverprofile=coverage.out
go tool cover -html=coverage.out
```

View File

@ -1,58 +0,0 @@
package gildedrose
type Item struct {
Name string
SellIn, Quality int
}
func UpdateQuality(items []*Item) {
for i := 0; i < len(items); i++ {
if items[i].Name != "Aged Brie" && items[i].Name != "Backstage passes to a TAFKAL80ETC concert" {
if items[i].Quality > 0 {
if items[i].Name != "Sulfuras, Hand of Ragnaros" {
items[i].Quality = items[i].Quality - 1
}
}
} else {
if items[i].Quality < 50 {
items[i].Quality = items[i].Quality + 1
if items[i].Name == "Backstage passes to a TAFKAL80ETC concert" {
if items[i].SellIn < 11 {
if items[i].Quality < 50 {
items[i].Quality = items[i].Quality + 1
}
}
if items[i].SellIn < 6 {
if items[i].Quality < 50 {
items[i].Quality = items[i].Quality + 1
}
}
}
}
}
if items[i].Name != "Sulfuras, Hand of Ragnaros" {
items[i].SellIn = items[i].SellIn - 1
}
if items[i].SellIn < 0 {
if items[i].Name != "Aged Brie" {
if items[i].Name != "Backstage passes to a TAFKAL80ETC concert" {
if items[i].Quality > 0 {
if items[i].Name != "Sulfuras, Hand of Ragnaros" {
items[i].Quality = items[i].Quality - 1
}
}
} else {
items[i].Quality = items[i].Quality - items[i].Quality
}
} else {
if items[i].Quality < 50 {
items[i].Quality = items[i].Quality + 1
}
}
}
}
}

View File

@ -1,19 +0,0 @@
package gildedrose_test
import (
"testing"
"github.com/emilybache/gildedrose-refactoring-kata/gildedrose"
)
func Test_Foo(t *testing.T) {
var items = []*gildedrose.Item{
{"foo", 0, 0},
}
gildedrose.UpdateQuality(items)
if items[0].Name != "fixme" {
t.Errorf("Name: Expected %s but got %s ", "fixme", items[0].Name)
}
}

View File

@ -1,3 +0,0 @@
module github.com/emilybache/gildedrose-refactoring-kata
go 1.18

View File

@ -1,46 +0,0 @@
package main
import (
"fmt"
"os"
"strconv"
"github.com/emilybache/gildedrose-refactoring-kata/gildedrose"
)
func main() {
fmt.Println("OMGHAI!")
var items = []*gildedrose.Item{
{"+5 Dexterity Vest", 10, 20},
{"Aged Brie", 2, 0},
{"Elixir of the Mongoose", 5, 7},
{"Sulfuras, Hand of Ragnaros", 0, 80},
{"Sulfuras, Hand of Ragnaros", -1, 80},
{"Backstage passes to a TAFKAL80ETC concert", 15, 20},
{"Backstage passes to a TAFKAL80ETC concert", 10, 49},
{"Backstage passes to a TAFKAL80ETC concert", 5, 49},
{"Conjured Mana Cake", 3, 6}, // <-- :O
}
days := 2
var err error
if len(os.Args) > 1 {
days, err = strconv.Atoi(os.Args[1])
if err != nil {
fmt.Println(err.Error())
os.Exit(1)
}
days++
}
for day := 0; day < days; day++ {
fmt.Printf("-------- day %d --------\n", day)
fmt.Println("Name, SellIn, Quality")
for i := 0; i < len(items); i++ {
fmt.Println(items[i])
}
fmt.Println("")
gildedrose.UpdateQuality(items)
}
}