Fix all of the math test except for block template-based methods.

This commit is contained in:
Tom Alexander 2020-06-13 21:37:11 -04:00
parent d9f10290f5
commit b897656cef
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 5 additions and 18 deletions

View File

@ -336,6 +336,7 @@ impl Castable for serde_json::Value {
impl CompareContextElement for serde_json::Value {
fn equals(&self, other: &dyn ContextElement) -> bool {
// println!("Json equality check {:?} == {:?}", self, other);
// Handle other serde_json::Value
match other.to_any().downcast_ref::<Self>() {
None => (),

View File

@ -202,6 +202,7 @@ impl Castable for OwnedLiteral {
impl CompareContextElement for OwnedLiteral {
fn equals(&self, other: &dyn ContextElement) -> bool {
// println!("Literal equality check {:?} == {:?}", self, other);
// If its an OwnedLiteral then compare them directly,
// otherwise defer to the other type's implementation of
// CompareContextElement since the end user could add any
@ -220,27 +221,12 @@ impl CompareContextElement for OwnedLiteral {
OwnedLiteral::LNegativeInteger(self_num),
OwnedLiteral::LNegativeInteger(other_num),
) => self_num == other_num,
(OwnedLiteral::LString(self_text), _) | (_, OwnedLiteral::LString(self_text)) => {
false
}
(OwnedLiteral::LFloat(self_num), OwnedLiteral::LFloat(other_num)) => {
self_num == other_num
}
(OwnedLiteral::LPositiveInteger(self_num), OwnedLiteral::LString(other_text)) => {
&self_num.to_string() == other_text
}
(OwnedLiteral::LString(self_text), OwnedLiteral::LPositiveInteger(other_num)) => {
self_text == &other_num.to_string()
}
(OwnedLiteral::LNegativeInteger(self_num), OwnedLiteral::LString(other_text)) => {
&self_num.to_string() == other_text
}
(OwnedLiteral::LString(self_text), OwnedLiteral::LNegativeInteger(other_num)) => {
self_text == &other_num.to_string()
}
(OwnedLiteral::LFloat(self_num), OwnedLiteral::LString(other_text)) => {
&self_num.to_string() == other_text
}
(OwnedLiteral::LString(self_text), OwnedLiteral::LFloat(other_num)) => {
self_text == &other_num.to_string()
}
(OwnedLiteral::LFloat(self_num), OwnedLiteral::LPositiveInteger(other_num)) => {
*self_num == (*other_num as f64)
}