//! The `end_to_end` example authorises its action before the work runs, so //! the cost that decision debits and the authority receipt seals is an //! estimate — never a hardware reading of work that had not happened. (The //! work's own energy is metered, at the meter's grade, in step 3.) Checked on //! the cost the example uses (the example file is compiled in here as a //! module). #[allow(dead_code)] #[path = "../examples/end_to_end.rs"] mod end_to_end; use jcp_schema::Provenance; #[test] fn the_authorisation_is_debited_an_estimate() { let cost = end_to_end::authorised_cost(); eprintln!("authorised cost: {} µJ [{}] measured {:?}", cost.uj(), cost.provenance.jcr1_label(), cost.measured_uj); assert_eq!(cost.provenance, Provenance::Estimator, "a pre-run cost graded {:?}", cost.provenance); assert_eq!(cost.measured_uj, None, "a measured figure for work that had not run"); assert!(cost.check_provenance().is_ok(), "{cost:?}"); }