mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 21:21:11 +00:00
Fix Weight::is_zero (#12396)
* Fix Weight::is_zero Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add test Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
committed by
GitHub
parent
2a27545afe
commit
8596339b49
@@ -318,7 +318,7 @@ impl Zero for Weight {
|
||||
}
|
||||
|
||||
fn is_zero(&self) -> bool {
|
||||
self.ref_time == 0
|
||||
self == &Self::zero()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,3 +447,16 @@ impl SubAssign for Weight {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn is_zero_works() {
|
||||
assert!(Weight::zero().is_zero());
|
||||
assert!(!Weight::from_components(1, 0).is_zero());
|
||||
assert!(!Weight::from_components(0, 1).is_zero());
|
||||
assert!(!Weight::MAX.is_zero());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user