Skip to content

Commit

Permalink
Reset parser for each test
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjgalloway committed Jun 12, 2020
1 parent a741ebc commit 9fb5b7b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions Tests/CGTCalcCoreTests/Examples/Outputs/CarryLoss.txt
Expand Up @@ -39,9 +39,9 @@ Calculation: (1 * 20000 - 0) - ( (1 * 1000 + 0) ) = 19000

# TRANSACTIONS

13: 01/01/2018 GB00B41YBW71 1 £1000 £0
14: 01/01/2018 GB00B41YBW71 1 £0 £0
15: 01/01/2019 GB00B41YBW71 1 £1000 £0
16: 01/01/2019 GB00B41YBW71 1 £2000 £0
17: 01/01/2020 GB00B41YBW71 1 £1000 £0
18: 01/01/2020 GB00B41YBW71 1 £20000 £0
1: 01/01/2018 GB00B41YBW71 1 £1000 £0
2: 01/01/2018 GB00B41YBW71 1 £0 £0
3: 01/01/2019 GB00B41YBW71 1 £1000 £0
4: 01/01/2019 GB00B41YBW71 1 £2000 £0
5: 01/01/2020 GB00B41YBW71 1 £1000 £0
6: 01/01/2020 GB00B41YBW71 1 £20000 £0
12 changes: 6 additions & 6 deletions Tests/CGTCalcCoreTests/Examples/Outputs/MultipleMatches.txt
Expand Up @@ -39,9 +39,9 @@ Calculation: (10 * 4.6702 - 12.5) - ( (10 * 5.4065) ) = -20

# TRANSACTIONS

5: 28/08/2018 GB00B41YBW71 10 £4.1565 £12.5
6: 28/08/2018 GB00B41YBW71 10 £4.6702 £12.5
7: 28/08/2019 GB00B41YBW71 10 £4.6702 £12.5
8: 20/09/2019 GB00B41YBW71 10 £4.1565 £12.5
9: 28/08/2020 GB00B41YBW71 10 £4.1565 £12.5
10: 28/10/2020 GB00B41YBW71 10 £4.6702 £12.5
1: 28/08/2018 GB00B41YBW71 10 £4.1565 £12.5
2: 28/08/2018 GB00B41YBW71 10 £4.6702 £12.5
3: 28/08/2019 GB00B41YBW71 10 £4.6702 £12.5
4: 20/09/2019 GB00B41YBW71 10 £4.1565 £12.5
5: 28/08/2020 GB00B41YBW71 10 £4.1565 £12.5
6: 28/10/2020 GB00B41YBW71 10 £4.6702 £12.5
4 changes: 2 additions & 2 deletions Tests/CGTCalcCoreTests/Examples/Outputs/Simple.txt
Expand Up @@ -19,5 +19,5 @@ Calculation: (10 * 4.6702 - 12.5) - ( (10 * 4.1565 + 12.5) ) = -20

# TRANSACTIONS

11: 28/08/2018 GB00B41YBW71 10 £4.6702 £12.5
12: 28/08/2018 GB00B41YBW71 10 £4.1565 £12.5
1: 28/08/2018 GB00B41YBW71 10 £4.6702 £12.5
2: 28/08/2018 GB00B41YBW71 10 £4.1565 £12.5
4 changes: 2 additions & 2 deletions Tests/CGTCalcCoreTests/ExamplesTests.swift
Expand Up @@ -13,7 +13,6 @@ class ExamplesTests: XCTestCase {

let record = false
let logger = StubLogger()
let parser = DefaultParser()

func testExamples() throws {
let thisFile = URL(fileURLWithPath: #file)
Expand All @@ -39,7 +38,8 @@ class ExamplesTests: XCTestCase {
}

do {
let transactions = try self.parser.transactions(fromData: inputData)
let parser = DefaultParser()
let transactions = try parser.transactions(fromData: inputData)
let calculator = try Calculator(transactions: transactions, logger: self.logger)
let result = try calculator.process()
let presenter = TextPresenter(result: result)
Expand Down

0 comments on commit 9fb5b7b

Please sign in to comment.