matrix-org / vodozemac

An implementation of Olm and Megolm in pure Rust.
Apache License 2.0
175 stars 30 forks source link

test(sas): Add mutation tests #140

Closed Johennes closed 7 months ago

Johennes commented 7 months ago

This fixes the following:

MISSED   src/sas.rs:152:9: replace SasBytes::emoji_indices -> [u8; 7] with [0; 7] in 0.8s build + 3.4s test
MISSED   src/sas.rs:152:9: replace SasBytes::emoji_indices -> [u8; 7] with [1; 7] in 0.9s build + 3.4s test
MISSED   src/sas.rs:160:9: replace SasBytes::decimals -> (u16, u16, u16) with (0, 0, 0) in 0.8s build + 3.1s test
MISSED   src/sas.rs:160:9: replace SasBytes::decimals -> (u16, u16, u16) with (0, 0, 1) in 0.8s build + 3.7s test
MISSED   src/sas.rs:160:9: replace SasBytes::decimals -> (u16, u16, u16) with (0, 1, 0) in 0.8s build + 3.0s test
MISSED   src/sas.rs:160:9: replace SasBytes::decimals -> (u16, u16, u16) with (0, 1, 1) in 0.8s build + 3.0s test
MISSED   src/sas.rs:160:9: replace SasBytes::decimals -> (u16, u16, u16) with (1, 0, 0) in 0.8s build + 3.7s test
MISSED   src/sas.rs:160:9: replace SasBytes::decimals -> (u16, u16, u16) with (1, 0, 1) in 0.8s build + 3.0s test
MISSED   src/sas.rs:160:9: replace SasBytes::decimals -> (u16, u16, u16) with (1, 1, 0) in 0.8s build + 3.0s test
MISSED   src/sas.rs:160:9: replace SasBytes::decimals -> (u16, u16, u16) with (1, 1, 1) in 0.8s build + 3.7s test
MISSED   src/sas.rs:166:9: replace SasBytes::as_bytes -> &[u8; 6] with &[0; 6] in 0.8s build + 2.9s test
MISSED   src/sas.rs:166:9: replace SasBytes::as_bytes -> &[u8; 6] with &[1; 6] in 0.8s build + 2.9s test
MISSED   src/sas.rs:204:35: replace | with ^ in SasBytes::bytes_to_decimal in 0.9s build + 3.0s test
MISSED   src/sas.rs:205:45: replace | with ^ in SasBytes::bytes_to_decimal in 0.8s build + 2.9s test
MISSED   src/sas.rs:205:61: replace | with ^ in SasBytes::bytes_to_decimal in 0.8s build + 2.9s test
MISSED   src/sas.rs:206:44: replace | with ^ in SasBytes::bytes_to_decimal in 0.8s build + 3.7s test
MISSED   src/sas.rs:384:9: replace EstablishedSas::verify_mac -> Result<(), SasError> with Ok(()) in 0.9s build + 3.8s test

While at it, I also removed the Result return values in the same file as recommended on one of my earlier PRs.

Relates to: #78

codecov-commenter commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 88.52%. Comparing base (4e51951) to head (62ab1a0).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #140 +/- ## ======================================= Coverage 88.52% 88.52% ======================================= Files 32 32 Lines 1786 1786 ======================================= Hits 1581 1581 Misses 205 205 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.