Slide 21
Slide 21 text
func test_༻༰ྔ͕0ͷͱ͖ʹ0ύʔηϯτදهʹͳΔ() {
let usage = 0
let limit = 1000000 * 1000 * 1000
let user = testUser(usage, limit)
XCTAssertEqual(user.storageUsageFormatted, "0%")
}
func test_༻༰ྔ͕0_01ύʔηϯτະຬͷͱ͖ʹ0ύʔηϯτදهʹͳΔ
let usage = 12 * 1000 * 1000
let limit = 1000000 * 1000 * 1000
let user = testUser(usage, limit)
XCTAssertEqual(user.storageUsageFormatted, "0%")
}
func test_༻༰ྔ͕0_1ύʔηϯτະຬͷͱ͖ʹখ2Ґ·ͰͷදهʹͳΔ
let usage = 123 * 1000 * 1000
let limit = 1000000 * 1000 * 1000
let user = testUser(usage, limit)
XCTAssertEqual(user.storageUsageFormatted, "0.01%")
}
func test_༻༰ྔ͕1ύʔηϯτະຬͷͱ͖ʹখ2Ґ·ͰͷදهʹͳΔ()
let usage = 1234 * 1000 * 1000
let limit = 1000000 * 1000 * 1000
let user = testUser(usage, limit)
XCTAssertEqual(user.storageUsageFormatted, "0.12%")
}
func test_༻༰ྔ͕10ύʔηϯτະຬͷͱ͖ʹখ1Ґ·ͰͷදهʹͳΔ(
ςετΛॻ͍ͯ҆৺͢Δ
• Ͳ͏ͳͬͯ΄͍͔͠ΛͪΌ
Μͱॻ͍ͯ֬ೝ͢Δ
• ࣮ࡍͷετϨʔδ༰ྔͰද
ࣔΛ֬ೝ͢Δͷඇݱ࣮త
• ϋϚΔͳͲΛཏྻ͠
ͯɺظ͢ΔදࣔʹͳΔ͜
ͱΛ֬ೝ