From b8d17aa354805d5dba260cd4d2a2cdd48a4f11ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20K=C3=B6tte?= Date: Sat, 23 May 2020 13:44:34 -0700 Subject: [PATCH] Remove unused methods, add test --- SwiftBeanCountModel/Commodity.swift | 20 +------------------- SwiftBeanCountModelTests/LedgerTests.swift | 5 +++++ 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/SwiftBeanCountModel/Commodity.swift b/SwiftBeanCountModel/Commodity.swift index ee1920c..41a8dcb 100644 --- a/SwiftBeanCountModel/Commodity.swift +++ b/SwiftBeanCountModel/Commodity.swift @@ -72,17 +72,7 @@ extension Commodity: CustomStringConvertible { } -extension Commodity: Comparable { - - /// **<** comparision of the `symbol`s - /// - /// - Parameters: - /// - lhs: commodity 1 - /// - rhs: commodity 1 - /// - Returns: lhs.symbol < rhs.symbol - public static func < (lhs: Commodity, rhs: Commodity) -> Bool { - lhs.symbol < rhs.symbol - } +extension Commodity: Equatable { /// Retuns if the two commodities are equal, meaning their `symbol`s and meta data are equal /// @@ -95,11 +85,3 @@ extension Commodity: Comparable { } } - -extension Commodity: Hashable { - - public func hash(into hasher: inout Hasher) { - hasher.combine(symbol) - } - -} diff --git a/SwiftBeanCountModelTests/LedgerTests.swift b/SwiftBeanCountModelTests/LedgerTests.swift index baf31dc..d2b0742 100644 --- a/SwiftBeanCountModelTests/LedgerTests.swift +++ b/SwiftBeanCountModelTests/LedgerTests.swift @@ -339,6 +339,11 @@ class LedgerTests: XCTestCase { let account2 = Account(name: accountName, opening: TestUtils.date20170609) try! ledger.add(account2) XCTAssertEqual(String(describing: ledger), String(describing: ledger.accounts.first!)) + + /// Test new line after account + let price = try! Price(date: TestUtils.date20170609, commoditySymbol: TestUtils.eur, amount: Amount(number: 10, commoditySymbol: TestUtils.cad, decimalDigits: 2)) + try! ledger.add(price) + XCTAssertEqual(String(describing: ledger), "\(String(describing: ledger.accounts.first!))\n\(String(describing: price))") } func testDescriptionPrice() {