Digital PCT265 story PCT-135: Switch to shallow equals with deep compare on parent in order to pinpoint midmatched models. Unit testing setup.
This commit is contained in:
parent
009bb01e1b
commit
71689b957b
@ -52,7 +52,7 @@ extension ModelProtocol {
|
||||
}
|
||||
|
||||
public protocol ModelComparisonProtocol {
|
||||
/// Deep checks if the curent model is equal to another model. Defaults to false unless implemented otherwise.
|
||||
/// Shallow checks if the curent model is equal to another model. Defaults to false unless implemented otherwise.
|
||||
func isEqual(to model: ModelComparisonProtocol) -> Bool
|
||||
}
|
||||
|
||||
@ -97,3 +97,15 @@ public extension Optional where Wrapped: Collection {
|
||||
return self.isEqual(to: models)
|
||||
}
|
||||
}
|
||||
|
||||
public extension Optional {
|
||||
/// Checks if
|
||||
func matchExistence(with anotherOptional: Optional) -> Bool {
|
||||
switch(self) {
|
||||
case .none:
|
||||
return anotherOptional == nil
|
||||
case .some(_):
|
||||
return anotherOptional != nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ public struct ModelRegistry {
|
||||
|
||||
MVMCoreLoggingHandler.shared()?.addError(toLog: errorObject)
|
||||
#if DEBUG
|
||||
triggerCrashInDebug()
|
||||
//triggerCrashInDebug()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user