Skip to content

Commit

Permalink
Remove unused methods, add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nef10 committed May 23, 2020
1 parent 86b95fc commit b8d17aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
20 changes: 1 addition & 19 deletions SwiftBeanCountModel/Commodity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand All @@ -95,11 +85,3 @@ extension Commodity: Comparable {
}

}

extension Commodity: Hashable {

public func hash(into hasher: inout Hasher) {
hasher.combine(symbol)
}

}
5 changes: 5 additions & 0 deletions SwiftBeanCountModelTests/LedgerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit b8d17aa

Please sign in to comment.