Merge pull request #254 from jonreid/master

Update Swift Package Manager, clean up starting test, add README
This commit is contained in:
Emily Bache authored and GitHub committed 2021-08-23 07:31:21 +02:00
commit 045597940b
4 files changed
+21 -11

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
// swift-tools-version:5.1
// swift-tools-version:5.3
import PackageDescription
+12
View File
@@ -0,0 +1,12 @@
## Build and test using any of the following
Command line:
- `swift test`
Xcode:
- Open this "swift" folder to open package
- In the Xcode menu, select Product > Test to run tests
AppCode:
- Open this "swift" folder to open package
- Select "GildedRoseTests" configuration and run
+3 -3
View File
@@ -1,12 +1,12 @@
public class GildedRose {
var items:[Item]
var items: [Item]
public init(items:[Item]) {
public init(items: [Item]) {
self.items = items
}
public func updateQuality() {
for i in 0..<items.count {
for i in 0 ..< items.count {
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") {
@@ -3,16 +3,14 @@ import XCTest
class GildedRoseTests: XCTestCase {
func testFoo() {
func testFoo() throws {
let items = [Item(name: "foo", sellIn: 0, quality: 0)]
let app = GildedRose(items: items);
app.updateQuality();
XCTAssertEqual("fixme", app.items[0].name);
let app = GildedRose(items: items)
app.updateQuality()
XCTAssertEqual(app.items[0].name, "fixme")
}
static var allTests : [(String, (GildedRoseTests) -> () throws -> Void)] {
return [
static var allTests = [
("testFoo", testFoo),
]
}
}