Closed jjenko closed 4 years ago
https://qiita.com/shira-shun/items/2c48e145c0872e77b0d5
callAsFunction
Property based testの思想の基に作られたSwiftCheckを使ってみた. テストケースにて,具体的な入力値と期待値は記述せず,テスト対象が満たすべき性質のみを記述する.
func testMaxWithInt() {
property("xがy以上であった場合にはxを返す.また,yがx以上であった場合にはxを返す.") <- forAll { (x: Int, y: Int) in
return x >= y ? max(x, y) == x : max(x, y) == y
}
カスタプタイプを使う場合は,Arbitraryに準拠させる必要がある. 💡Sourceryで自動的に準拠させたい.
struct ComplexNumber {
let realPart: Double
let imaginarryPart: Double
var size: Double {
return sqrt(pow(realPart, 2) + pow(imaginarryPart, 2))
}
}
extension ComplexNumber: CustomStringConvertible {
var description: String {
let operatorString = imaginarryPart >= 0 ? "+" : "-"
return "\(realPart)\(operatorString)j\(abs(imaginarryPart))"
}
}
extension ComplexNumber: Comparable {
static func < (lhs: ComplexNumber, rhs: ComplexNumber) -> Bool {
return lhs.size < rhs.size
}
}
property("xがy以上でありyがx以上であった場合にはx==y(antisymmetric law)") <- forAll { (x: Int, y: Int) in
return max(x, y) == x && max(y, x) == y ? x == y : x != y
}
}
extension ComplexNumber: Arbitrary {
public static var arbitrary : Gen<ComplexNumber> {
return Gen<(Double, Double)>.zip(Double.arbitrary, Double.arbitrary).map(ComplexNumber.init)
}
}
https://github.com/AvdLee/Poes
$ mint install AvdLee/Poes
$ Poes --bundle-identifier com.wetransfer.app --verbose
Generated payload:
{
"aps" : {
"alert" : {
"title" : "Default title",
"body" : "Default body"
},
"mutable-content" : false
}
}
Sending push notification...
Push notification sent successfully
command line toolのwrapperで、payload.jsonを作ってくれる
$ xcrun simctl push booted com.wetransfer.app payload.json
Notification sent to 'com.wetransfer.app'
https://www.avanderlee.com/wp-content/uploads/2020/02/testing_push_notification_apns_file.mp4
APNS fileはpayload.jsonに似ているけど、Simulator Target Bundle
が必要
{
"Simulator Target Bundle": "com.wetransfer.app",
"aps": {
"alert": {
"body": "Gerard added something new - take a look",
"title": "Photos"
}
}
}
(ちなみに樫原さんはpush通知送る君
を作った)
⚠️ This repository is public. / 公開リポジトリです。
Why
Where
Pearl Jam (Subject to change)
5F, MG Shirokanedai Building (Wantedly, Inc. Tokyo HQ)
Who
You are working for Wantedly? Sure, you can join anytime. If not, you need to contact us first. Or, you can "want to visit" the meetup, which you can find in www.wantedly.com/companies/wantedly/projects.
What
You write topics like below contents and we talk about these on the meetup. Every participant needs to write one topic at least.
Also, you can find new topics from the newsletters:
How
・・・
参加者は開催までに話したいことを少なくとも1トピックをコメントしましょう。 ネタ被りを避けるために、まずはタイトルだけでコメントすることを推奨します。 より多くの学びを得るためにどんな内容でもアウトプットを歓迎します!😊
cc/ @wantedly/ios
Previous issue
https://github.com/wantedly/ios_night/issues/86
_Created from https://github.com/wantedly/ios_night/issues/85 by issue-creator_