Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an example Xcode project file to include in 'hello world' exercise #49

Closed
masters3d opened this issue May 22, 2015 · 0 comments
Closed
Milestone

Comments

@masters3d
Copy link
Contributor

exercism/objective-c#27

Create Empty Xcode File
exercism/exercism#2401 (comment)

Update WorkFlow.md
Use this tutorial as a basis to update the WorkFlow.md file
http://samuelmullen.com/2014/09/unit-testing-in-swift/

Example Solution to HelloWorld

struct HelloWorld{
    static func hello( _ input:String = "World") -> String{
        return "Hello, \(input)!"
    }
}

Hello World Test File

import XCTest

class  HelloWorldTest: XCTestCase {

    func testNoName(){
        let expected = "Hello, World!"
        XCTAssertEqual(HelloWorld.hello(), expected, "When given no name, we should greet the world!")
    }

    func testSampleName(){
        let expected = "Hello, Alice!"
        XCTAssertEqual(HelloWorld.hello("Alice"), expected, "When given 'Alice', we should greet Alice!")
    }

    func testOtherSampleName(){
        let expected = "Hello, Bob!"
        XCTAssertEqual(HelloWorld.hello("Bob"), expected, "When given 'Bob', we should greet Bob!")
    }

    func testNoStrangeName(){
        let expected = "Hello, !"
        XCTAssertEqual(HelloWorld.hello(""), expected, "When given an empty string, it is strange, but should have a space and punctuation")
    }

}
@masters3d masters3d added this to the Swift 2.0 milestone Aug 14, 2015
masters3d added a commit to masters3d/xswift that referenced this issue Sep 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant