From babbd1350019d8c34d56fa9c1bb03a5853f29779 Mon Sep 17 00:00:00 2001 From: Hugo Trentesaux <hugo@trentesaux.fr> Date: Sat, 5 Oct 2019 22:51:31 +0200 Subject: [PATCH] wip c'est au vert grace au commentaires --- .../bc-db-reader/src/current_frame.rs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/modules-lib/bc-db-reader/src/current_frame.rs b/lib/modules-lib/bc-db-reader/src/current_frame.rs index 07e32599..bb4f35fe 100644 --- a/lib/modules-lib/bc-db-reader/src/current_frame.rs +++ b/lib/modules-lib/bc-db-reader/src/current_frame.rs @@ -58,6 +58,7 @@ pub fn get_member_diffi<DB: DbReadable, R: DbReader>( unimplemented!(); } + /// calcule la difficulté personnalisée à partir des données prêtes à l'emploi /// reference dans le protocol : https://github.com/duniter/duniter/blob/master/doc/Protocol.md#br_g18---headpowzeros-and-headpowremainder pub fn compute_personal_difficulty( @@ -148,4 +149,25 @@ mod tests { compute_personal_difficulty(50, BlockNumber(1000), BlockNumber(1010), 5, 1) ); } + + // test avec db mockée + // #[test] + // fn test_personal_difficulty_member_not_in_frame() -> Result<(), DbError> { + // let db = crate::tests::open_tmp_db()?; + // db.write(|mut w| { + // //common::insert_wot_index_entry(&db, &mut w, WotId(0), issuer_a)?; + // Ok(w) + // })?; + // db.read(|r| { + // //common::insert_wot_index_entry(&db, &mut w, WotId(0), issuer_a)?; + // assert_eq!( + // PersonalDifficulty { + // exclusion_factor: 1, + // handicap: 0 + // }, + // get_member_diffi(db,r, WotId(0)) + // ); + // })?; + + // } } -- GitLab