Commit ea9306c0 authored by Tetsuro Takemoto's avatar Tetsuro Takemoto 🐝

fix: issue#22 OnboardingServiceTests and String-ExtenstionTest fail

parent d845cfbb
......@@ -1629,7 +1629,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/XWallet/external-libs/monero_v0.12",
"$(PROJECT_DIR)/XWallet/external-libs/monero_v0.14",
Please register or sign in to reply
"$(PROJECT_DIR)/XWallet/external-libs/openssl",
"$(PROJECT_DIR)/XWallet/external-libs/boost",
);
......@@ -1666,7 +1666,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/XWallet/external-libs/monero_v0.12",
"$(PROJECT_DIR)/XWallet/external-libs/monero_v0.14",
"$(PROJECT_DIR)/XWallet/external-libs/openssl",
"$(PROJECT_DIR)/XWallet/external-libs/boost",
);
......
......@@ -13,34 +13,30 @@ extension String {
public subscript(i: Int) -> Character {
return self[index(startIndex, offsetBy: i)]
}
public subscript(i: Int) -> String {
return String(self[i] as Character)
}
// public subscript(r: Range<Int>) -> String {
// let start = index(startIndex, offsetBy: r.lowerBound)
// let end = index(startIndex, offsetBy: r.upperBound)
// return String(self[Range(start ..< end)])
// }
public subscript(r: Range<Int>) -> String {
let start = index(startIndex, offsetBy: r.lowerBound)
let end = index(startIndex, offsetBy: r.upperBound)
return String(self[start..<end])
}
public subscript(r: ClosedRange<Int>) -> String {
let start = index(startIndex, offsetBy: r.lowerBound)
let end = index(startIndex, offsetBy: r.upperBound)
return String(self[start...end])
}
public func suffix(count: Int) -> String {
let startIndex = self.index(self.endIndex, offsetBy: -count)
let last = self[startIndex...]
return String(last)
}
/// Converts string to Double using locale decimal separator
// Converts string to Double using locale decimal separator
public func toDouble() -> Double? {
let nf = NumberFormatter()
nf.locale = Locale.current
......@@ -48,15 +44,15 @@ extension String {
return Double(truncating: d)
}
/// Checks if can be converted into a double
// Checks if can be converted into a double
public func isValidDouble() -> Bool {
guard let _ = self.toDouble() else { return false }
return true
}
/// Adds or removes leading zero
/// eg. "00" -> "0", ".123" -> "0.123", "" -> "0"
/// If value is not a valid double then returns nil
// Adds or removes leading zero
// eg. "00" -> "0", ".123" -> "0.123", "" -> "0"
// If value is not a valid double then returns nil
public func prettyPrintDouble() -> String? {
if self.isEmpty {
return "0"
......@@ -73,9 +69,10 @@ extension String {
if decimalSeparator.count < 1 {
return self.prettyPrintInt()
}
let split = self.split(separator: decimalSeparator[0], maxSplits: 1, omittingEmptySubsequences: false)
// let sp: String = String(decimalSeparator.prefix(1))
Please register or sign in to reply
let split: [Substring] = self.split(separator: decimalSeparator[0], maxSplits: 1, omittingEmptySubsequences: false)
Please register or sign in to reply
if split.count < 2 {
return self.prettyPrintInt()
}
......@@ -93,15 +90,3 @@ extension String {
return "\(asInt)"
}
}
......@@ -178,6 +178,7 @@ extension OnboardingServiceTests {
private class SecureStoreMock: SecureStoreProtocol {
var appPin: String?
var walletPassword: String?
var appleWatch2FAPassword: String?
  • I should run the UTs more often, don't I?

  • Yes. We should run the UTs before a push. I think Githooks or CI servers(like CircleCI and TravisCI) are useful for us to run tests automatically.

Please register or sign in to reply
var nodeUserId: String = ""
var nodePassword: String = ""
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment