This repository has been archived by the owner on Sep 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathCalculator.swift.gcov
64 lines (64 loc) · 1.89 KB
/
Calculator.swift.gcov
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
-: 0:Source:/Users/katsumi/Dropbox/Xcode Projects/SwiftCov/Examples/ExampleFramework/ExampleFramework/Calculator.swift
-: 0:Runs:1
-: 0:Programs:1
-: 1://
-: 2:// Calculator.swift
-: 3:// ExampleFramework
-: 4://
-: 5:// Created by Kishikawa Katsumi on 2015/05/27.
-: 6:// Copyright (c) 2015 Realm. All rights reserved.
-: 7://
-: 8:
-: 9:import Foundation
-: 10:
-: 11:public class Calculator {
8: 12: public var x: Int?
8: 13: public var y: Int?
-: 14:
-: 15: public init() { }
-: 16:
-: 17: public init(a: Int, b: Int) {
2: 18: x = a
2: 19: y = b
-: 20: }
-: 21:
-: 22: public func add(a: Int, b: Int) -> Int {
1: 23: if let x = x {
#####: 24: y = x
-: 25: }
1: 26: if let y = y {
#####: 27: x = y
-: 28: }
1: 29: return a + b
-: 30: }
-: 31:
-: 32: public func sub(a: Int, b: Int) -> Int {
1: 33: if let x = x {
1: 34: y = x
-: 35: }
1: 36: if let y = y {
1: 37: x = y
-: 38: }
1: 39: return a - b
-: 40: }
-: 41:
-: 42: public func mul(a: Int, b: Int) -> Int {
1: 43: if let x = x {
1: 44: y = x
-: 45: }
1: 46: if let y = y {
1: 47: x = y
-: 48: }
1: 49: return a * b
-: 50: }
-: 51:
-: 52: public func div(a: Int, b: Int) -> Int {
#####: 53: if let x = x {
#####: 54: y = x
-: 55: }
#####: 56: if let y = y {
#####: 57: x = y
-: 58: }
#####: 59: return a / b
-: 60: }
-: 61:}